/* =============================================================================
   Genisium v3.0 — Premium PWA Styles
   Aurora Dark Theme + Vanta.js + Glass Morphism + GSAP
   ============================================================================= */

/* =============================================================================
   A11y utilities (U1/U2/U6) — labels sr-only e skip-link por teclado.
   ============================================================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent, #00F0FF);
    color: #000;
    padding: 8px 16px;
    z-index: 9999;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 6px 0;
    transition: top 120ms ease-out;
}
.skip-link:focus,
.skip-link:focus-visible {
    top: 0;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* U7 — prevenir zoom automático do iOS em inputs (alternativa a user-scalable=no). */
@media (max-width: 480px) {
    input, textarea, select {
        font-size: 16px;
    }
}

/* U21 — indicação visual de mensagens pendentes/falhadas + botão retry */
.message--pending {
    opacity: 0.6;
}
.message--failed .message-content {
    border: 1px solid rgba(255, 90, 90, 0.6);
    background: rgba(255, 90, 90, 0.08);
}
.message-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 0 0;
    font-size: 12px;
    color: #ff9aa0;
}
.btn-retry {
    background: rgba(255, 105, 180, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 105, 180, 0.5);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.btn-retry:hover,
.btn-retry:focus-visible {
    background: rgba(255, 105, 180, 0.35);
    outline: 2px solid #fff;
    outline-offset: 1px;
}

/* =============================================================================
   Knowledge + Brain panel
   ============================================================================= */

.kb-panel-card {
    max-width: 920px;
    width: min(92vw, 920px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 20px 22px;
    gap: 12px;
    overflow: hidden;
}

.kb-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
}
.kb-panel-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.kb-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0;
}
.kb-tab {
    background: transparent;
    color: var(--text-secondary, #9aa0ae);
    border: 0;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 120ms, border-color 120ms;
}
.kb-tab:hover { color: #fff; }
.kb-tab.active {
    color: #fff;
    border-bottom-color: var(--accent, #00F0FF);
}

.kb-section {
    display: none;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
}
.kb-section.active { display: flex; }

/* Brain */
.kb-brain-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.kb-meta {
    font-size: 12px;
    color: var(--text-secondary, #9aa0ae);
    font-variant-numeric: tabular-nums;
}
.kb-brain-actions { display: flex; gap: 8px; }

#kb-brain-textarea {
    flex: 1 1 auto;
    min-height: 320px;
    max-height: 55vh;
    width: 100%;
    background: rgba(10, 10, 18, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e8eaf0;
    border-radius: 8px;
    padding: 12px 14px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}
#kb-brain-textarea:focus {
    outline: none;
    border-color: var(--accent, #00F0FF);
    box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.2);
}
.kb-hint {
    font-size: 11px;
    color: var(--text-secondary, #9aa0ae);
    margin: 0;
}

/* KB list tab */
.kb-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.kb-toolbar #kb-search-input {
    flex: 1 1 220px;
    min-width: 200px;
    background: rgba(10, 10, 18, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e8eaf0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
}
.kb-toolbar #kb-filter-kind {
    background: rgba(10, 10, 18, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e8eaf0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}
.kb-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary, #9aa0ae);
}

.kb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 200px;
}
.kb-list .kb-loading,
.kb-list .kb-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary, #9aa0ae);
}
.kb-entry {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: rgba(16, 16, 24, 0.4);
    transition: border-color 120ms;
}
.kb-entry:hover { border-color: rgba(255, 255, 255, 0.16); }
.kb-entry.archived { opacity: 0.55; }
.kb-entry-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.kb-kind {
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 240, 255, 0.12);
    color: var(--accent, #00F0FF);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.kb-entry-title {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
}
.kb-archived-badge {
    font-size: 10px;
    background: rgba(255, 105, 180, 0.15);
    color: #ff9ed6;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}
.kb-entry-body {
    font-size: 12px;
    color: var(--text-secondary, #c7cbd6);
    margin-top: 6px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 80px;
    overflow: hidden;
    line-height: 1.5;
}
.kb-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.kb-tag {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.07);
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--text-secondary, #9aa0ae);
}
.kb-entry-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    justify-content: flex-end;
}

/* Botões reutilizáveis do painel */
.kb-btn-primary {
    background: linear-gradient(135deg, #FF69B4, #00F0FF);
    color: #000;
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.kb-btn-primary:hover { filter: brightness(1.1); }
.kb-btn-primary:disabled { opacity: 0.6; cursor: wait; }
.kb-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #e8eaf0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
}
.kb-btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

/* Edit sub-modal */
.kb-inner-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}
.kb-inner-modal.hidden { display: none; }
.kb-edit-card {
    background: rgba(16, 16, 24, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px 22px;
    width: min(90vw, 600px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.kb-edit-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.kb-edit-card header h4 {
    margin: 0;
    font-size: 15px;
    color: #fff;
}
#kb-edit-form label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary, #9aa0ae);
    margin-bottom: 10px;
}
#kb-edit-form input,
#kb-edit-form select,
#kb-edit-form textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    background: rgba(10, 10, 18, 0.5);
    color: #e8eaf0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
}
#kb-edit-form textarea {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    resize: vertical;
    min-height: 160px;
}
.kb-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Commit C — KB review tab (candidatos auto-extracted) */
.kb-review-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: linear-gradient(135deg, #FF69B4, #00F0FF);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
}
.kb-review-badge.hidden { display: none; }
.kb-review-intro {
    margin-bottom: 8px;
}
.kb-review-candidate {
    border-left: 3px solid rgba(0, 240, 255, 0.5);
}

/* Skills panel (Commit F) — chips editáveis + confidence bar */
.skills-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}
.skills-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 105, 180, 0.18);
    color: #fff;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.skills-chip-x {
    background: transparent;
    color: #fff;
    border: 0;
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.7;
}
.skills-chip-x:hover { opacity: 1; }
.skills-chip-input {
    background: rgba(10, 10, 18, 0.5);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    color: #e8eaf0;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    min-width: 180px;
    outline: none;
}
.skills-chip-input:focus {
    border-color: var(--accent, #00F0FF);
    background: rgba(0, 240, 255, 0.05);
}
.skills-confidence-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}
.skills-confidence-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #FF69B4, #00F0FF);
    transition: width 200ms ease-out;
}
.skills-confidence-bar.low > span { background: rgba(255, 165, 100, 0.8); }
.skills-confidence-bar.mid > span { background: linear-gradient(90deg, #FFD93D, #00F0FF); }

/* U23 — toast de status da WS connection */
.ws-toast {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0) + 12px);
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(20, 20, 30, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 105, 180, 0.5);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 9998;
    font-size: 14px;
    max-width: calc(100vw - 32px);
}
.ws-toast-btn {
    background: linear-gradient(135deg, #FF69B4, #00F0FF);
    color: #000;
    border: 0;
    border-radius: 6px;
    padding: 6px 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}
.ws-toast-btn:hover,
.ws-toast-btn:focus-visible {
    filter: brightness(1.1);
    outline: 2px solid #fff;
    outline-offset: 1px;
}

/* New-message notification toasts (stack canto inferior direito) */
.msg-notif-container {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0) + 16px);
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
    max-width: 340px;
}
.msg-notif {
    pointer-events: auto;
    background: #FFFFFF;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: var(--shadow-md);
    font-size: 13px;
    line-height: 1.4;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.28s var(--ease-out), opacity 0.28s ease;
}
.msg-notif.show {
    transform: translateX(0);
    opacity: 1;
}
.msg-notif.is-bot { border-left-color: var(--accent-secondary); }
.msg-notif-head {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 12px;
    color: var(--accent-hover);
}
.msg-notif-body {
    color: var(--text-secondary);
    font-size: 12px;
    word-break: break-word;
}
@media (max-width: 600px) {
    .msg-notif-container { left: 8px; right: 8px; max-width: none; }
    .msg-notif { transform: translateY(120%); }
}


:root {
    /* Colors — Genisium Light / Violet */
    --bg-primary: #F5F3FF;       /* fundo app — lavanda muito clara */
    --bg-secondary: #EDE9FE;     /* sidebar / painéis */
    --bg-tertiary: #DDD6FE;      /* hover / divisores suaves */
    --bg-elevated: #FFFFFF;      /* bubbles bot, cards */
    --bg-main: #FAF8FF;
    --bg-glass: rgba(255, 255, 255, 0.75);
    --bg-glass-strong: rgba(255, 255, 255, 0.92);

    --bg-message-user: linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);
    --bg-message-user-solid: #7C3AED;
    --bg-message-assistant: #FFFFFF;

    --text-primary: #1F1937;     /* violeta-escuro quase preto */
    --text-secondary: #5B5276;
    --text-muted: #8B82A8;
    --text-bright: #0F0A1F;

    /* Brand accent — Violet (Genisium logo) */
    --accent: #8B5CF6;
    --accent-hover: #7C3AED;
    --accent-soft: rgba(139, 92, 246, 0.10);
    --accent-glow: rgba(139, 92, 246, 0.22);
    --accent-rgb: 139, 92, 246;

    /* Secondary accent — magenta para hovers e aura */
    --accent-secondary: #C084FC;

    --gradient-brand: linear-gradient(135deg, #7C3AED 0%, #C084FC 100%);
    --gradient-brand-hover: linear-gradient(135deg, #C084FC 0%, #7C3AED 100%);
    --gradient-subtle: linear-gradient(135deg, rgba(139,92,246,0.08) 0%, rgba(192,132,252,0.06) 100%);

    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;

    --border: rgba(139, 92, 246, 0.12);
    --border-hover: rgba(139, 92, 246, 0.22);
    --border-glass: rgba(139, 92, 246, 0.16);
    --shadow-sm: 0 1px 2px rgba(31, 25, 55, 0.06);
    --shadow-md: 0 4px 12px rgba(31, 25, 55, 0.08);
    --shadow-lg: 0 8px 32px rgba(31, 25, 55, 0.12);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.18);
    --shadow-glow-strong: 0 0 40px rgba(192, 132, 252, 0.28);

    /* Sizing */
    --header-height: 60px;
    --input-height: 64px;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --radius-full: 9999px;

    /* Safe areas (iOS) */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =============================================================================
   Reset & Base
   ============================================================================= */

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.hidden {
    display: none !important;
}

/* Vanta canvas container */
.vanta-canvas,
.vanta-canvas canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Canvas injectado pelo Vanta nunca sobrepõe conteúdo */
#vanta-login-bg canvas,
#vanta-bg canvas {
    z-index: 0 !important;
    position: absolute !important;
    pointer-events: none !important;
}

/* =============================================================================
   Logo SVG — Animated
   ============================================================================= */

.logo-svg .logo-arc {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawArc 1.5s var(--ease-out) forwards;
}

.logo-svg .logo-bar {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    animation: drawBar 0.6s var(--ease-out) 0.8s forwards;
}

.logo-svg .logo-ring {
    animation: ringPulse 4s ease-in-out infinite;
}

.logo-svg .logo-dot {
    animation: dotPulse 3s ease-in-out infinite;
}

.logo-animated .logo-orbital-1 {
    transform-origin: 24px 24px;
    animation: orbital 8s linear infinite;
}

.logo-animated .logo-orbital-2 {
    transform-origin: 24px 24px;
    animation: orbital 8s linear infinite reverse;
}

@keyframes drawArc {
    to { stroke-dashoffset: 0; }
}

@keyframes drawBar {
    to { stroke-dashoffset: 0; }
}

@keyframes ringPulse {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(1.02); }
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.9; r: 2; }
    50% { opacity: 1; r: 3; }
}

@keyframes orbital {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =============================================================================
   Landing Page
   ============================================================================= */

#landing-screen {
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-primary);
}

.landing-content {
    position: relative;
    z-index: 1;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Nav */
.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(10, 10, 18, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-nav-cta {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    backdrop-filter: blur(10px);
}

.btn-nav-cta:hover {
    background: var(--accent-soft);
    border-color: rgba(0, 240, 255, 0.3);
    color: var(--text-bright);
    box-shadow: var(--shadow-glow);
}

/* Simple Landing Header */
.landing-simple-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    z-index: 10;
}

.landing-simple-header .header-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hero - Ultra Simple */
.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px 40px;
    min-height: 100vh;
    position: relative;
}

/* Hero Eyes Wrapper */
.hero-eyes-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 60px;
}

/* Background glow — cyan/pink mesh (match landing palette) */
.hero-eyes-glow {
    position: absolute;
    width: 350px;
    height: 350px;
    background:
        radial-gradient(circle at 35% 40%, rgba(0, 240, 255, 0.28) 0%, transparent 55%),
        radial-gradient(circle at 70% 60%, rgba(255, 105, 180, 0.22) 0%, transparent 60%),
        radial-gradient(circle, rgba(6, 148, 148, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 3s ease-in-out infinite;
    filter: blur(50px);
}

@keyframes glowPulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* Eyes Container */
.hero-eyes-container {
    display: flex;
    gap: 40px;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    animation: eyesFloat 5s ease-in-out infinite;
}

@keyframes eyesFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Eyes — Cyan/Teal Genisium Glass Style */
.hero-eye {
    width: 140px;
    height: 175px;
    background: radial-gradient(ellipse at 40% 30%, #E0FBFF 0%, #7BE5F0 18%, #00F0FF 42%, #069494 75%, #024545 100%);
    border-radius: 50% 50% 48% 48%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 60px 20px rgba(0, 240, 255, 0.65),
        0 0 120px 40px rgba(6, 148, 148, 0.40),
        0 0 200px 60px rgba(255, 105, 180, 0.20),
        inset 0 3px 6px rgba(255, 255, 255, 0.35);
    overflow: hidden;
    animation: heroBlink 6s ease-in-out infinite;
}

.hero-eye-right {
    animation-delay: 0.15s;
}

/* Eye highlight */
.hero-eye::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 35% 25%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.15) 35%, transparent 65%);
    border-radius: inherit;
    pointer-events: none;
}

/* Bottom reflection */
.hero-eye::after {
    content: '';
    position: absolute;
    bottom: 5%;
    left: 10%;
    right: 10%;
    height: 12%;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.15));
    border-radius: 50%;
    pointer-events: none;
}

/* Pupil */
.hero-pupil {
    width: 42px;
    height: 52px;
    background: radial-gradient(ellipse at 40% 35%, #1e1b4b 0%, #0a0a12 50%, #000 100%);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
}

/* Pupil highlight */
.hero-pupil::after {
    content: '';
    position: absolute;
    top: 15%;
    right: 15%;
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
}

/* Blink animation */
@keyframes heroBlink {
    0%, 92%, 100% { transform: scaleY(1); }
    96% { transform: scaleY(0.03); }
}

/* Hero actions - just the button */
.hero-actions {
    display: flex;
    gap: 16px;
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 36px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    background: var(--gradient-brand);
    color: #FFFFFF;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.30);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    box-shadow: 0 4px 20px rgba(255, 105, 180, 0.40), 0 0 40px rgba(0, 240, 255, 0.25);
}

.btn-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 105, 180, 0.55), 0 0 60px rgba(0, 240, 255, 0.35);
}

.btn-hero:active {
    transform: translateY(0) scale(0.98);
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px 24px 60px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.feature-card {
    padding: 24px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s var(--ease-out);
}

.feature-card:hover {
    border-color: rgba(0, 240, 255, 0.2);
    background: rgba(26, 26, 38, 0.6);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border-radius: 12px;
    color: var(--accent);
    margin-bottom: 14px;
}

.feature-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.feature-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* =============================================================================
   Login Screen
   ============================================================================= */

#login-screen {
    /* Tokens locais da palete glassmorphism (espelham a landing) */
    --gl-pink:      #FF69B4;
    --gl-teal:      #069494;
    --gl-cyan:      #00F0FF;
    --gl-white:     #FFFFFF;
    --gl-dark:      #0A1428;
    --gl-dark-deep: #050A1A;
    --gl-card-bg:     rgba(255, 255, 255, 0.08);
    --gl-card-border: rgba(255, 255, 255, 0.18);
    --gl-card-blur:   20px;
    --gl-card-radius: 28px;

    justify-content: center;
    align-items: center;
    padding: 24px;
    overflow: hidden;
    position: relative;
    isolation: isolate;
    background: radial-gradient(ellipse at top, var(--gl-dark) 0%, var(--gl-dark-deep) 100%);
}

/* Camada 1 — mesh gradient blobs (igual à landing) */
#login-screen::before {
    content: '';
    position: absolute;
    inset: -20% -20% -20% -20%;
    z-index: -2;
    background:
        radial-gradient(40vw 40vw at 80% 20%, var(--gl-pink) 0%, transparent 60%),
        radial-gradient(50vw 50vw at 20% 75%, var(--gl-teal) 0%, transparent 65%),
        radial-gradient(35vw 35vw at 30% 20%, var(--gl-cyan) 0%, transparent 60%),
        radial-gradient(30vw 30vw at 75% 80%, var(--gl-pink) 0%, transparent 65%);
    filter: blur(80px) saturate(140%);
    opacity: 0.50;
    animation: gl-mesh-drift 32s ease-in-out infinite alternate-reverse;
    will-change: transform;
    pointer-events: none;
}

/* Camada 2 — noise grain texture */
#login-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/></svg>");
    background-size: 220px 220px;
    opacity: 0.06;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: gl-card-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    backdrop-filter: blur(10px);
    z-index: 20;
}

.btn-back:hover {
    color: #FFFFFF;
    border-color: rgba(0, 240, 255, 0.45);
    background: rgba(0, 240, 255, 0.10);
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.20);
}

.login-card {
    background: var(--gl-card-bg);
    border: 1px solid var(--gl-card-border);
    border-radius: var(--gl-card-radius);
    padding: 40px 32px;
    -webkit-backdrop-filter: blur(var(--gl-card-blur)) saturate(180%);
    backdrop-filter: blur(var(--gl-card-blur)) saturate(180%);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.30),
        inset 0 -1px 0 0 rgba(0, 240, 255, 0.18),
        0 30px 80px -20px rgba(255, 105, 180, 0.28),
        0 12px 40px -10px rgba(0, 240, 255, 0.18);
    text-align: center;
    width: 100%;
}

.login-header {
    margin-bottom: 32px;
}

.login-header .logo-svg {
    margin-bottom: 16px;
}

/* Logo SVG Wrapper para centralizar acima do card de login */
.login-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 8px;
    /* Reduzir um bocado o tamanho no login vs landing se for preciso, ou manter auto */
}

.login-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.username-input-container input,
.pin-input-container input {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    font-family: inherit;
    background: rgba(10, 20, 40, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    color: #FFFFFF;
    outline: none;
    transition: all 0.3s var(--ease-out);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.pin-input-container input {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 18px;
    letter-spacing: 4px;
}

.username-input-container input:focus,
.pin-input-container input:focus {
    border-color: rgba(0, 240, 255, 0.70);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.15), 0 0 20px rgba(0, 240, 255, 0.15);
    background: rgba(10, 20, 40, 0.75);
}

.username-input-container input::placeholder,
.pin-input-container input::placeholder {
    font-family: 'Inter', sans-serif;
    color: rgba(255, 255, 255, 0.38);
    font-size: 14px;
    letter-spacing: normal;
}

/* Hint small abaixo do input — educa user sobre formatos aceites */
.login-hint {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.45;
}
.login-hint code {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px;
    color: var(--accent, #00F0FF);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    background: linear-gradient(135deg,
        rgba(255, 105, 180, 0.55) 0%,
        rgba(0, 240, 255, 0.55) 100%);
    color: #FFFFFF;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.40);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.35),
        0 8px 24px -6px rgba(255, 105, 180, 0.45),
        0 4px 12px -2px rgba(0, 240, 255, 0.30);
    letter-spacing: -0.01em;
    width: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #FF69B4 0%, #00F0FF 100%);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.45),
        0 16px 36px -8px rgba(255, 105, 180, 0.60),
        0 8px 20px -4px rgba(0, 240, 255, 0.45);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.25), 0 4px 12px -4px rgba(255, 105, 180, 0.40);
}

.btn-primary svg {
    transition: transform 0.3s var(--ease-out);
}

.btn-primary:hover svg {
    transform: translateX(3px);
}

.error-text {
    color: var(--error);
    font-size: 13px;
    min-height: 20px;
    font-weight: 500;
}

/* =============================================================================
   Chat Screen
   ============================================================================= */

#chat-screen {
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    background: var(--bg-primary);
}

/* Header */
.chat-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-small {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-title {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.02em;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.4s var(--ease-out);
    margin-right: 4px;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
    animation: statusPulse 3s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(52, 211, 153, 0.3); }
    50% { box-shadow: 0 0 12px rgba(52, 211, 153, 0.6); }
}

.status-dot.connecting {
    background: var(--warning);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    /* semantic warning (amber) — matches --warning background of .status-dot.connecting */
    0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(251, 191, 36, 0.25); }
    50% { opacity: 0.4; box-shadow: 0 0 12px rgba(251, 191, 36, 0.45); }
}

.btn-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.btn-icon:hover {
    background: var(--accent-soft);
    color: var(--text-bright);
}

.btn-icon:active {
    transform: scale(0.92);
}

.btn-icon.active {
    color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.35) inset;
}

.btn-icon.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-icon.disabled:hover {
    background: transparent;
    color: var(--text-secondary);
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px;
    scroll-behavior: smooth;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 100%;
}

/* Message Bubble — Teams-style compact */
.message {
    max-width: 88%;
    padding: 6px 10px;
    border-radius: 8px;
    word-wrap: break-word;
    position: relative;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(8px);
    animation: msgIn 0.25s var(--ease-out) forwards;
}

/* Bubbles consecutivas do mesmo emissor — agrupar sem espaço */
.message + .message.user,
.message + .message.assistant {
    margin-top: 2px;
}

@keyframes msgIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: var(--bg-message-user);
    color: white;
    border-bottom-right-radius: 2px;
    box-shadow: var(--shadow-sm);
}

.message.assistant {
    align-self: flex-start;
    background: var(--bg-message-assistant);
    border: 1px solid var(--border);
    border-bottom-left-radius: 2px;
}

/* =============================================================================
 * Bubble distinction — self / peer / bot
 *
 * Problema: em DMs e grupos com 2+ members + bot, todas as bubbles do tipo
 * "user" ficavam visualmente idênticas (mesmo gradient pink/cyan), tornando
 * impossível distinguir o que disse o próprio user vs o que disse o outro
 * member. Resolvido cruzando state.user.member_id com msg.sender_member_id.
 *
 * - bubble-self: pink/cyan gradient (mantém o look familiar do user actual)
 * - bubble-peer: roxo→magenta (distinto mas complementar; alinhado à esquerda)
 * - bubble-bot:  dark com border accent + ✨ (claramente "não-humano")
 * ============================================================================= */

/* Self: já é o pink/cyan do .message.user — sem override necessário */

.message.user.bubble-peer {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.55), rgba(236, 72, 153, 0.45));
    color: #fff;
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.18);
    backdrop-filter: blur(6px);
}

.message.assistant.bubble-bot {
    border-left: 3px solid var(--accent, #00F0FF);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.18), var(--shadow-sm);
}

.message.assistant.bubble-bot .message-content::before {
    content: '✨ ';
    margin-right: 2px;
    font-size: 13px;
    opacity: 0.9;
}

/* Sender label (nome do peer) — só aparece em grupos para clarificar autoria */
.msg-sender {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 4px;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    opacity: 0.75;
}

/* Message Content — Markdown (Teams-compact) */
.message-content {
    font-size: 13px;
    line-height: 1.4;
}

.message-content p {
    margin-bottom: 3px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content code {
    background: rgba(0, 240, 255, 0.15);
    padding: 2px 7px;
    border-radius: var(--radius-xs);
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.85em;
    color: #7BE5F0;
}

.message.user .message-content code {
    background: rgba(255, 255, 255, 0.18);
    color: #e0e7ff;
}

.message-content pre {
    background: #0d0d15;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid var(--border);
}

.message-content pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
}

.message-content ul, .message-content ol {
    padding-left: 20px;
    margin: 6px 0;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content strong {
    color: var(--text-bright);
    font-weight: 600;
}

.message.user .message-content strong {
    color: white;
}

.message-content h1, .message-content h2, .message-content h3 {
    color: var(--text-bright);
    margin: 12px 0 6px;
    font-weight: 600;
}

.message-content h1 { font-size: 18px; }
.message-content h2 { font-size: 16px; }
.message-content h3 { font-size: 15px; }

.message-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 13px;
}

.message-content th, .message-content td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}

.message-content th {
    background: rgba(0, 240, 255, 0.08);
    font-weight: 600;
    color: var(--text-bright);
}

.message-content a {
    color: #7BE5F0;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 1px;
    min-height: 14px;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Action buttons (thread, task, speak) — só visíveis em hover */
.message .btn-thread,
.message .btn-task-from-msg,
.message .btn-speak {
    opacity: 0;
    transition: opacity 0.12s ease;
}
.message:hover .btn-thread,
.message:hover .btn-task-from-msg,
.message:hover .btn-speak {
    opacity: 1;
}

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

.btn-speak {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    padding: 0;
    opacity: 0;
}

.message.assistant:hover .btn-speak {
    opacity: 1;
}

.btn-speak:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-speak.speaking {
    opacity: 1;
    color: var(--accent);
    animation: speakPulse 1.2s ease-in-out infinite;
}

@keyframes speakPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
    background: var(--bg-message-assistant);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    align-self: flex-start;
    max-width: 72px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
    opacity: 0.6;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.32s; }

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

/* Input Container */
.input-container {
    padding: 12px 16px 16px;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #FFFFFF;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    transition: all 0.3s var(--ease-out);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: #FFFFFF;
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 4px 0;
}

#message-input::placeholder {
    color: var(--text-muted);
}

.btn-send {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-brand);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.btn-send:hover:not(:disabled) {
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: scale(1.05);
}

.btn-send:active:not(:disabled) {
    transform: scale(0.92);
}

.btn-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--bg-elevated);
    box-shadow: none;
}

/* Attach Button */
.btn-attach {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    flex-shrink: 0;
}
.btn-attach:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* Attach Preview */
.attach-preview {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}
.attach-thumb {
    position: relative;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-main);
}
.attach-thumb img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    display: block;
}
.attach-thumb.attach-file {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}
.attach-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.attach-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 4px;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Voice Wake Indicator */
.voice-wake-indicator {
    color: #22c55e;
    display: flex;
    align-items: center;
    animation: wakeBreath 2s ease-in-out infinite;
}
@keyframes wakeBreath {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Images in messages */
.message-content img {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    transition: transform 0.2s;
}
.message-content img:hover {
    transform: scale(1.02);
}

/* Mic Button */
.btn-mic {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    flex-shrink: 0;
}

.btn-mic:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* Voice mode activo (verde) */
.btn-mic.voice-active {
    border-color: #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.btn-mic.recording {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Voice mode: hide text while preparing TTS */
.message.assistant.voice-pending .message-content {
    min-height: 24px;
    color: transparent;
}
.message.assistant.voice-pending .message-content::after {
    content: '🔊 A preparar resposta...';
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
    position: absolute;
    left: 16px;
    top: 12px;
}
.message.assistant.voice-pending {
    position: relative;
}

.btn-mic.processing {
    border-color: var(--accent);
    color: var(--accent);
    animation: micSpin 1s linear infinite;
}

@keyframes micSpin {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* =============================================================================
   Welcome Message
   ============================================================================= */

.welcome-message {
    text-align: center;
    padding: 20px 24px 60px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}

/* Logo hidden: floating character already provides visual identity */
.welcome-message .welcome-logo {
    display: none;
}

.welcome-message h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.welcome-message p {
    font-size: 14px;
    max-width: 280px;
    line-height: 1.6;
}

.welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
    max-width: 380px;
}

.welcome-chip {
    padding: 8px 16px;
    background: var(--gradient-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    white-space: nowrap;
}

.welcome-chip:hover {
    border-color: rgba(0, 240, 255, 0.3);
    color: var(--text-bright);
    background: var(--accent-soft);
    transform: translateY(-1px);
}

/* =============================================================================
   Screen Transitions (GSAP-driven, these are fallback)
   ============================================================================= */

.screen-enter {
    opacity: 0;
    transform: translateY(20px);
}

.screen-exit {
    opacity: 0;
    transform: translateY(-20px);
}

/* =============================================================================
   Scrollbar
   ============================================================================= */

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* =============================================================================
   Selection
   ============================================================================= */

::selection {
    background: rgba(0, 240, 255, 0.3);
    color: var(--bg-primary);
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 480px) {
    .message {
        max-width: 90%;
    }

    .welcome-suggestions {
        padding: 0 8px;
    }

    .hero-title {
        font-size: 28px;
    }

    .features {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .login-card {
        padding: 32px 24px;
    }
}

@media (min-width: 768px) {
    .messages-container {
        padding: 28px 12%;
    }

    .message {
        max-width: 68%;
    }

    .input-container {
        padding: 12px 12% 20px;
    }

    .hero {
        padding: 100px 40px 60px;
    }

    .features {
        padding: 20px 40px 80px;
    }
}

@media (min-width: 1200px) {
    .messages-container {
        padding: 32px 20%;
    }

    .input-container {
        padding: 12px 20% 20px;
    }

    .message {
        max-width: 60%;
    }

    .hero {
        padding: 120px 60px 80px;
    }
}

/* =============================================================================
   Focus visible (accessibility)
   ============================================================================= */

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* =============================================================================
   Modal Overlay (Telegram Pairing, etc.)
   ============================================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: modalFadeIn 0.2s ease-out;
}
.modal-overlay.hidden {
    display: none;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    animation: modalSlideUp 0.25s ease-out;
}
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.modal-close:hover {
    color: var(--text-primary);
}

.modal-icon {
    margin-bottom: 12px;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.modal-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 20px;
    line-height: 1.5;
}
.modal-desc code {
    background: var(--bg-main);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: monospace;
    letter-spacing: 2px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.modal-input:focus {
    border-color: var(--accent);
}

.modal-btn {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: var(--gradient-brand);
    color: #0a0a12;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}
.modal-btn:hover {
    opacity: 0.9;
}
.modal-btn:active {
    transform: scale(0.98);
}
.modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pair-status {
    min-height: 20px;
    margin-top: 10px;
    font-size: 0.8rem;
    line-height: 1.4;
}
.pair-status.success {
    color: #22c55e;
}
.pair-status.error {
    color: #ef4444;
}

/* =============================================================================
   Character Stage — Genisium Animated Face
   ============================================================================= */

.character-stage {
    /* Float above chat — sem caixa opaca, só os olhos com glow */
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 10;
    height: clamp(140px, 18dvh, 180px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    overflow: visible;
    pointer-events: none;
}

.char-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Aura glow ring */
.char-aura {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    transition: box-shadow 0.6s ease, background 0.6s ease;
    pointer-events: none;
}

.char-aura.aura-idle {
    /* Soft amber glow at rest */
    box-shadow: 0 0 40px 8px rgba(0, 240, 255, 0.18), 0 0 80px 20px rgba(255, 105, 180, 0.08);
    animation: auraPulse 3s ease-in-out infinite;
}
.char-aura.aura-thinking {
    /* Stronger amber — processing */
    box-shadow: 0 0 50px 12px rgba(0, 240, 255, 0.35), 0 0 100px 30px rgba(255, 105, 180, 0.12);
    animation: auraPulse 1.2s ease-in-out infinite;
}
.char-aura.aura-listening {
    /* Green kept — semantic: active/listening/go */
    box-shadow: 0 0 50px 14px rgba(52, 211, 153, 0.3), 0 0 90px 30px rgba(52, 211, 153, 0.1);
    animation: auraRing 1s ease-in-out infinite;
}
.char-aura.aura-speaking {
    /* Intense amber — energy/speaking */
    box-shadow: 0 0 60px 16px rgba(0, 240, 255, 0.5), 0 0 120px 40px rgba(255, 105, 180, 0.25);
    animation: auraPulse 0.5s ease-in-out infinite;
}
.char-aura.aura-happy {
    /* Bright warm amber — happy */
    box-shadow: 0 0 60px 16px rgba(0, 240, 255, 0.45), 0 0 100px 30px rgba(123, 229, 240, 0.22);
    animation: auraPulse 1.5s ease-in-out infinite;
}
.char-aura.aura-alert {
    /* Red kept — semantic: error/alert */
    box-shadow: 0 0 60px 16px rgba(248, 113, 113, 0.4), 0 0 100px 30px rgba(248, 113, 113, 0.15);
    animation: auraFlash 0.4s ease-in-out infinite;
}
.char-aura.aura-sleeping {
    /* Very dim amber — dormant */
    box-shadow: 0 0 20px 4px rgba(0, 240, 255, 0.06);
    animation: auraPulse 6s ease-in-out infinite;
}

@keyframes auraPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.04); }
}
@keyframes auraRing {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
@keyframes auraFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Face — transparent so only eyes float in the dark */
.char-face {
    width: 160px;
    height: 160px;
    background: transparent;
    border-radius: 50%;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: relative;
    transition: transform 0.4s var(--ease-spring);
    animation: charFloat 4s ease-in-out infinite;
}

.char-face.state-sleeping {
    animation: charFloat 8s ease-in-out infinite;
}
.char-face.state-speaking {
    animation: charFloat 2s ease-in-out infinite;
}
.char-face.state-alert {
    animation: charShake 0.3s ease-in-out 2;
}

@keyframes charFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}
@keyframes charShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Eyes */
.char-eyes {
    display: flex;
    gap: 16px;
    align-items: center;
}

.char-eye {
    width: 48px;
    height: 60px;
    background: radial-gradient(ellipse at 40% 30%, #F5F0FF 0%, #C4B5FD 25%, #8B5CF6 55%, #4C1D95 100%);
    border-radius: 50% 50% 45% 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, border-radius 0.3s ease, height 0.3s ease;
    position: relative;
    /* Glow violeta — visível em fundo claro */
    box-shadow:
        0 0 24px 6px rgba(139, 92, 246, 0.55),
        0 0 50px 16px rgba(192, 132, 252, 0.30),
        0 0 90px 32px rgba(76, 29, 149, 0.10),
        inset 0 2px 4px rgba(255, 255, 255, 0.4);
    overflow: hidden;
}

/* Inner gradient overlay for 3D effect */
.char-eye::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 35% 25%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.1) 40%, transparent 70%);
    border-radius: inherit;
    pointer-events: none;
}

/* Bottom reflection highlight */
.char-eye::after {
    content: '';
    position: absolute;
    bottom: 8%;
    left: 15%;
    right: 15%;
    height: 20%;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.15));
    border-radius: 50%;
    pointer-events: none;
}

.char-pupil {
    width: 16px;
    height: 20px;
    background: radial-gradient(ellipse at 40% 35%, #1e1b4b 0%, #0a0a12 60%, #000 100%);
    border-radius: 50%;
    position: relative;
    transition: transform 0.2s ease;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Pupil highlight - small bright dot */
.char-pupil::after {
    content: '';
    position: absolute;
    top: 15%;
    right: 15%;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Mouth */
.char-mouth-wrap {
    width: 60px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: height 0.25s ease;
}

.char-mouth {
    width: 36px;
    height: 3px;
    background: linear-gradient(90deg, rgba(245,158,11,0.5), rgba(251,191,36,0.8), rgba(252,211,77,0.5));
    border-radius: 0 0 20px 20px;
    transition: height 0.15s ease, border-radius 0.15s ease, transform 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 240, 255, 0.2);
    opacity: 0.7;
}

/* Chat screen layout — mobile-first */
#chat-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

#messages-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: clamp(160px, 24dvh, 240px);
}

/* Action pills */
.action-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 12px 10px;
}

.action-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: rgba(0, 240, 255, 0.10);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: var(--radius-full);
    color: #7BE5F0;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.action-pill:hover {
    background: rgba(0, 240, 255, 0.18);
    border-color: rgba(0, 240, 255, 0.45);
}

.action-pill:active {
    transform: scale(0.96);
}

.action-pill--subtle {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
}

.action-pill--subtle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
}

/* =============================================================================
   Landing v2 — Glassmorphism com palete pink/teal/cyan
   Best practices 2026: gradient mesh + noise + restraint + saturate + GPU
   ============================================================================= */

/* Tokens locais da palete nova (não polui :root global ainda) */
/* IMPORTANT: usar :not(.hidden) — caso contrário o id selector vence .hidden */
#landing-screen {
    --gl-pink:  #FF69B4;
    --gl-teal:  #069494;
    --gl-cyan:  #00F0FF;
    --gl-white: #FFFFFF;
    --gl-dark:  #0A1428;
    --gl-dark-deep: #050A1A;

    /* Glass tokens */
    --gl-card-bg:     rgba(255, 255, 255, 0.08);
    --gl-card-border: rgba(255, 255, 255, 0.18);
    --gl-card-blur:   20px;
    --gl-card-radius: 28px;

    position: relative;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(ellipse at top, var(--gl-dark) 0%, var(--gl-dark-deep) 100%);
    isolation: isolate;
}
#landing-screen:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Camada 1 — gradient mesh blobs (3 blobs com filter blur) */
#landing-screen::before {
    content: '';
    position: absolute;
    inset: -20% -20% -20% -20%;
    z-index: -2;
    background:
        radial-gradient(40vw 40vw at 20% 25%, var(--gl-pink) 0%, transparent 60%),
        radial-gradient(50vw 50vw at 75% 70%, var(--gl-teal) 0%, transparent 65%),
        radial-gradient(35vw 35vw at 70% 25%, var(--gl-cyan) 0%, transparent 60%),
        radial-gradient(30vw 30vw at 25% 80%, var(--gl-pink) 0%, transparent 65%);
    filter: blur(80px) saturate(140%);
    opacity: 0.55;
    animation: gl-mesh-drift 28s ease-in-out infinite alternate;
    will-change: transform;
    pointer-events: none;
}

/* Camada 2 — noise grain texture (mata sensação plástica) */
#landing-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/></svg>");
    background-size: 220px 220px;
    opacity: 0.06;
    mix-blend-mode: overlay;
    pointer-events: none;
}

@keyframes gl-mesh-drift {
    0%   { transform: translate3d(0, 0, 0)     scale(1)    rotate(0deg); }
    50%  { transform: translate3d(2%, -3%, 0)  scale(1.05) rotate(2deg); }
    100% { transform: translate3d(-2%, 2%, 0)  scale(1.02) rotate(-1deg); }
}

/* Glass card central — único elemento "vidro" pesado (restraint principle) */
.landing-glass-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 56px 56px 44px;
    width: min(92vw, 520px);

    background: var(--gl-card-bg);
    -webkit-backdrop-filter: blur(var(--gl-card-blur)) saturate(180%);
    backdrop-filter: blur(var(--gl-card-blur)) saturate(180%);
    border: 1px solid var(--gl-card-border);
    border-radius: var(--gl-card-radius);

    /* Lighting layered: top highlight + bottom rim + soft pink shadow */
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.30),
        inset 0 -1px 0 0 rgba(0, 240, 255, 0.18),
        0 30px 80px -20px rgba(255, 105, 180, 0.30),
        0 12px 40px -10px rgba(0, 240, 255, 0.20);

    transform: translateZ(0);
    will-change: transform;
    animation: gl-card-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes gl-card-in {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Logo wrap (SVG) */
.gl-logo {
    width: 280px;
    height: 95px;
    filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.35));
    animation: gl-logo-pulse 6s ease-in-out infinite;
}
@keyframes gl-logo-pulse {
    0%, 100% { filter: drop-shadow(0 0 24px rgba(0, 240, 255, 0.30)); }
    50%      { filter: drop-shadow(0 0 40px rgba(255, 105, 180, 0.45)); }
}

/* Tagline */
.gl-tagline {
    margin: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.5;
}

/* Olhos redesenhados — orbs cyan/white com glass ring */
.gl-eyes {
    display: flex;
    gap: 28px;
    align-items: center;
    justify-content: center;
    margin: 8px 0 4px;
}
.gl-eye {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            var(--gl-white) 0%,
            rgba(255, 255, 255, 0.85) 18%,
            var(--gl-cyan) 55%,
            var(--gl-teal) 90%);
    box-shadow:
        0 0 22px rgba(0, 240, 255, 0.55),
        0 0 50px rgba(0, 240, 255, 0.25),
        inset 0 2px 6px rgba(255, 255, 255, 0.35);
    animation: gl-eye-pulse 3.5s ease-in-out infinite;
}
.gl-eye-right { animation-delay: 0.18s; }
.gl-eye::before {
    /* Ring de glass à volta do olho */
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    pointer-events: none;
}
.gl-pupil {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    background: var(--gl-teal);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.4);
}
.gl-pupil::after {
    content: '';
    position: absolute;
    top: 18%;
    left: 22%;
    width: 5px;
    height: 5px;
    background: var(--gl-white);
    border-radius: 50%;
    opacity: 0.9;
}
@keyframes gl-eye-pulse {
    0%, 100% { box-shadow: 0 0 22px rgba(0, 240, 255, 0.55), 0 0 50px rgba(0, 240, 255, 0.25), inset 0 2px 6px rgba(255, 255, 255, 0.35); }
    50%      { box-shadow: 0 0 28px rgba(255, 105, 180, 0.5),  0 0 60px rgba(255, 105, 180, 0.3),  inset 0 2px 6px rgba(255, 255, 255, 0.45); }
}

/* CTA glass-on-glass */
.btn-mega {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 42px;
    margin-top: 12px;

    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #FFFFFF;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);

    background: linear-gradient(135deg,
        rgba(255, 105, 180, 0.55) 0%,
        rgba(0, 240, 255, 0.55) 100%);
    -webkit-backdrop-filter: blur(8px) saturate(160%);
    backdrop-filter: blur(8px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.50);
    border-radius: 16px;
    cursor: pointer;

    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.45),
        0 8px 28px -4px rgba(255, 105, 180, 0.50),
        0 4px 14px -2px rgba(0, 240, 255, 0.35);
}
.btn-mega:hover {
    background: linear-gradient(135deg, var(--gl-pink) 0%, var(--gl-cyan) 100%);
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.40),
        0 16px 36px -8px rgba(255, 105, 180, 0.55),
        0 8px 24px -4px rgba(0, 240, 255, 0.40);
}
.btn-mega:active { transform: translateY(0); }
.btn-mega svg { transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.btn-mega:hover svg { transform: translateX(4px); }
.btn-mega:focus-visible {
    outline: 2px solid var(--gl-cyan);
    outline-offset: 3px;
}

/* Hint discreto */
.gl-hint {
    margin: 0;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-align: center;
}

/* =============================================================================
   Reduced motion — desactiva animações infinitas (acessibilidade + bateria)
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
    #landing-screen::before,
    #login-screen::before { animation: none; }
    .gl-logo, .gl-eye { animation: none; }
    .landing-glass-card { animation: none; }
    .login-container { animation: none; }
}

/* =============================================================================
   Fallback @supports — browsers sem backdrop-filter (Firefox antigo)
   ============================================================================= */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .landing-glass-card,
    .login-card {
        background: rgba(10, 20, 40, 0.85);
        border-color: rgba(255, 255, 255, 0.25);
    }
    .btn-mega {
        background: linear-gradient(135deg, var(--gl-pink), var(--gl-cyan));
    }
    .gl-eye::before { background: rgba(255, 255, 255, 0.08); }
}

/* Mobile tweaks */
@media (max-width: 480px) {
    .landing-glass-card {
        padding: 40px 32px;
        gap: 20px;
    }
    .gl-logo { width: 220px; height: 75px; }
    .gl-eye  { width: 52px; height: 52px; }
    .gl-pupil { width: 14px; height: 14px; }
    /* Reduzir blur em mobile (Safari pode ficar lento) */
    #landing-screen { --gl-card-blur: 14px; }
}

/* =============================================================================
   Tasks Panel — split layout desktop + bottom sheet mobile
   ============================================================================= */

/* Default: painel escondido em mobile (aparece via .open bottom sheet) */
.tasks-panel {
    display: none;
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
}

/* Desktop: 3 colunas — sidebar (conversas) | chat | right-panel (tasks + sales) */
/* IMPORTANT: usar :not(.hidden) para não vencer .hidden { display: none !important } */
@media (min-width: 1024px) {
    #chat-screen:not(.hidden) {
        display: grid;
        grid-template-columns: 280px 1fr 360px;
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "sidebar header header"
            "sidebar main   right"
            "sidebar input  right";
        height: 100vh;
        height: 100dvh;
    }
    #chat-screen > .chat-header { grid-area: header; }
    #chat-screen > #conversations-sidebar { grid-area: sidebar; }
    #chat-screen > #character-stage,
    #chat-screen > #messages-container { grid-area: main; }
    #chat-screen > .input-container { grid-area: input; }
    #chat-screen > #right-panel {
        grid-area: right;
        display: grid;
        grid-template-rows: 2fr 1fr;
        min-height: 0;
        overflow: hidden;
        border-left: 1px solid var(--border);
        background: var(--bg-secondary);
    }
    #chat-screen > #right-panel > .tasks-panel {
        display: flex;
        flex-direction: column;
        border: none;
        border-radius: 0;
        background: var(--bg-secondary);
        overflow: hidden;
        min-height: 0;
    }
    #chat-screen > #right-panel > .sales-chatbot {
        display: flex;
        flex-direction: column;
        border-top: 1px solid var(--border);
        background: var(--bg-tertiary);
        overflow: hidden;
        min-height: 0;
    }
    #chat-screen:not(.hidden).tasks-collapsed {
        grid-template-columns: 280px 1fr 0;
    }
    #chat-screen.tasks-collapsed > #right-panel {
        display: none;
    }
    #tp-mobile-toggle { display: none !important; }
}

/* Header do painel */
.tp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}
.tp-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-bright);
    margin: 0;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}
.tp-scope {
    display: inline-flex;
    gap: 2px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    margin-left: auto;
}
.tp-scope-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s var(--ease-out);
}
.tp-scope-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.tp-select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}
.tp-collapse-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    margin-left: auto;
    transition: color 0.15s var(--ease-out);
}
.tp-scope + .tp-collapse-btn,
.tp-select + .tp-collapse-btn { margin-left: 4px; }
.tp-collapse-btn:hover { color: var(--text-primary); }

/* Filtros */
.tp-filters {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.tp-filters::-webkit-scrollbar { display: none; }
.tp-filter {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-full);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s var(--ease-out);
}
.tp-filter:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.tp-filter.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}
.tp-inline-badge {
    display: inline-block;
    background: var(--error);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    margin-left: 4px;
    vertical-align: middle;
}
.tp-inline-badge.hidden { display: none; }

/* Banner (not-linked / vazio) */
.tp-banner {
    padding: 14px;
    margin: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 12px;
    line-height: 1.5;
}
.tp-banner.hidden { display: none; }

/* Lista de tasks */
.tp-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    margin: 0;
    list-style: none;
    min-height: 0;
}
.tp-list:empty::after {
    content: "Sem tarefas neste filtro";
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 40px 16px;
    font-style: italic;
}
.tp-task {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 8px;
    padding: 6px 8px;
    margin-bottom: 3px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.15s var(--ease-out);
    cursor: default;
}
.tp-task:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}
.tp-task.done {
    opacity: 0.5;
}
.tp-task.done .tp-task-title {
    text-decoration: line-through;
}
/* Status backgrounds — diferenciação por urgência */
.tp-task.overdue {
    background: rgba(239, 68, 68, 0.06);
    border-left: 3px solid var(--error);
}
.tp-task.today {
    background: rgba(139, 92, 246, 0.08);
    border-left: 3px solid var(--accent);
}
.tp-task.tomorrow {
    background: rgba(245, 158, 11, 0.05);
    border-left: 3px solid var(--warning);
}
.tp-task.future {
    background: var(--bg-elevated);
    border-left: 3px solid var(--success);
}
.tp-task.no-date {
    background: var(--bg-elevated);
    border-left: 3px solid var(--text-muted);
}
/* Priority overrides border-left */
.tp-task.priority-urgent { border-left: 3px solid var(--error); }
.tp-task.priority-high   { border-left: 3px solid var(--warning); }
.tp-task.priority-low    { border-left: 3px solid var(--text-muted); }
.tp-check {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    position: relative;
    grid-row: 1;
    align-self: start;
    margin-top: 2px;
    transition: all 0.15s var(--ease-out);
}
.tp-check:checked {
    background: var(--accent);
}
.tp-check:checked::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 3px;
    width: 3px;
    height: 6px;
    border: solid #000;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}
.tp-task-title {
    grid-column: 2;
    grid-row: 1;
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
}
.tp-task-meta {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    gap: 8px;
    font-size: 10px;
    color: var(--text-secondary);
    align-items: center;
    flex-wrap: wrap;
}
.tp-task-meta .tp-due { color: var(--text-secondary); }
.tp-task.overdue .tp-task-meta .tp-due { color: var(--error); font-weight: 600; }
.tp-task-meta .tp-priority-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.tp-task-meta .tp-priority-urgent { background: rgba(248,113,113,0.15); color: var(--error); }
.tp-task-meta .tp-priority-high   { background: rgba(251,191,36,0.15); color: var(--warning); }
.tp-task-meta .tp-priority-normal { background: var(--bg-primary); color: var(--text-secondary); }
.tp-task-meta .tp-priority-low    { background: var(--bg-primary); color: var(--text-muted); }
.tp-task-meta .tp-project { color: var(--text-muted); }
.tp-task-actions {
    grid-column: 3;
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s var(--ease-out);
}
.tp-task:hover .tp-task-actions { opacity: 1; }
.tp-task-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s var(--ease-out);
    font-size: 12px;
    line-height: 1;
}
.tp-task-btn:hover { color: var(--accent); background: var(--accent-soft); }
/* Archive btn: hover vermelho para sinalizar destructive action */
.tp-task-btn-archive:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}

/* Quick create */
.tp-quick-create {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
}
.tp-quick-create input {
    flex: 1;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s var(--ease-out);
}
.tp-quick-create input:focus { border-color: var(--accent); }
.tp-quick-create select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    font-size: 11px;
    cursor: pointer;
    max-width: 100px;
}
.tp-quick-create select:focus { border-color: var(--accent); outline: none; }
.tp-add-btn {
    background: var(--gradient-brand);
    color: #000;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.tp-add-btn:hover { transform: scale(1.05); }
.tp-add-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Mobile: painel vira bottom sheet */
@media (max-width: 1023px) {
    .tasks-panel.open {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 70vh;
        border-top: 1px solid var(--accent);
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-radius: var(--radius) var(--radius) 0 0;
        background: var(--bg-secondary);
        z-index: 40;
        box-shadow: var(--shadow-lg);
        animation: tp-sheet-up 0.25s var(--ease-out);
        padding-bottom: var(--safe-bottom);
    }
    .tp-mobile-toggle {
        position: fixed;
        right: 16px;
        bottom: calc(80px + var(--safe-bottom));
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: var(--gradient-brand);
        color: #000;
        border: none;
        z-index: 30;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--shadow-md);
    }
}
.tp-mobile-toggle { display: none; }
@media (max-width: 1023px) {
    .tp-mobile-toggle { display: flex; }
}
.tp-mobile-toggle .tp-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error);
    color: #000;
    border-radius: 999px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}
.tp-mobile-toggle .tp-badge.hidden { display: none; }

@keyframes tp-sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* =============================================================================
   Conversations Sidebar (esquerda) — redesign Teams-like
   ============================================================================= */

.conv-sidebar {
    display: none;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

@media (min-width: 1024px) {
    #chat-screen > .conv-sidebar {
        display: flex;
    }
}

.conv-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.conv-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.conv-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-bright);
    margin: 0;
    letter-spacing: 0.01em;
}
.conv-new-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-bright);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 120ms var(--ease-out), border-color 120ms var(--ease-out), transform 120ms var(--ease-out);
}
.conv-new-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    border-color: transparent;
    color: #000;
    transform: scale(1.05);
}

/* Picker modal */
.conv-picker-card {
    max-width: 420px;
    width: 92vw;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 20px 16px;
}
.conv-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.conv-picker-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-bright);
}
#conv-picker-search {
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-bright);
    font-size: 13px;
    outline: none;
}
#conv-picker-search:focus { border-color: var(--accent); }
.conv-picker-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 50vh;
    overflow-y: auto;
}
.conv-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 120ms var(--ease-out);
}
.conv-picker-item:hover {
    background: var(--bg-glass);
}
.conv-picker-item .conv-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
}
.conv-picker-item .conv-picker-name {
    font-size: 13px;
    color: var(--text-bright);
}
.conv-picker-item .conv-picker-role {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.conv-search {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-bright);
    font-size: 13px;
    outline: none;
    transition: border-color 180ms var(--ease-out);
}
.conv-search:focus {
    border-color: var(--accent);
}

.conv-sections {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 0;
}
.conv-loading,
.conv-empty {
    padding: 20px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
}
.conv-section-title {
    padding: 10px 16px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    opacity: 0.7;
}

.conv-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.conv-item {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    grid-template-rows: auto auto;
    grid-gap: 2px 10px;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 120ms var(--ease-out), border-color 120ms var(--ease-out);
}
.conv-item:hover {
    background: var(--bg-glass);
}
.conv-item.active {
    background: linear-gradient(90deg, rgba(0,240,255,0.08), rgba(255,105,180,0.04));
    border-left-color: var(--accent);
}
.conv-avatar {
    grid-row: 1 / 3;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    flex-shrink: 0;
    user-select: none;
}
.conv-avatar.avatar-bot {
    background: linear-gradient(135deg, #069494, #00F0FF);
}
.conv-avatar.avatar-group {
    background: linear-gradient(135deg, #FF69B4, #A855F7);
}
.conv-avatar.avatar-member {
    background: linear-gradient(135deg, #00F0FF, #069494);
}
.conv-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.conv-preview {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    grid-column: 2;
}
.conv-time {
    grid-column: 3;
    grid-row: 1;
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
}
.conv-unread {
    grid-column: 3;
    grid-row: 2;
    background: var(--accent);
    color: #000;
    border-radius: 999px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}
.conv-unread.hidden { display: none; }
.conv-pinned-tag {
    grid-column: 3;
    grid-row: 1;
    font-size: 10px;
    color: var(--accent);
    opacity: 0.7;
}

/* =============================================================================
   Sales Chatbot (painel direito inferior)
   ============================================================================= */

.sales-chatbot {
    display: none;  /* desktop override abre; em mobile fica escondido por default */
}

.sc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}
.sc-icon { font-size: 14px; }
.sc-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    margin: 0;
    flex: 1;
    letter-spacing: 0.01em;
}
.sc-hint {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    cursor: help;
    user-select: none;
}

.sc-feed {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
.sc-msg {
    max-width: 92%;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.45;
    word-wrap: break-word;
}
.sc-msg.sc-user {
    background: rgba(0,240,255,0.08);
    border: 1px solid rgba(0,240,255,0.18);
    color: var(--text-bright);
    align-self: flex-end;
}
.sc-msg.sc-bot {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-bright);
    align-self: flex-start;
}
.sc-msg.sc-error {
    border-color: rgba(255, 80, 80, 0.35);
    color: #ffb3b3;
}
.sc-details {
    margin-top: 6px;
    font-size: 10px;
    color: var(--text-secondary);
}
.sc-details summary { cursor: pointer; }
.sc-details pre {
    margin: 4px 0 0;
    padding: 6px 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 10px;
}

.sc-form {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}
.sc-form input {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-bright);
    font-size: 12px;
    outline: none;
}
.sc-form input:focus { border-color: var(--accent); }
.sc-send {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    border: none;
    color: #000;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 120ms var(--ease-out);
}
.sc-send:hover { transform: translateY(-1px); }
.sc-send[disabled] {
    opacity: 0.4;
    cursor: wait;
    transform: none;
}

/* Mobile: 3 ecras navegaveis (sidebar / chat / right-panel) */
@media (max-width: 1023px) {
    #chat-screen:not(.hidden) {
        position: relative;
        overflow: hidden;
    }
    /* Por defeito, sidebar e right-panel ficam escondidos em mobile;
       o JS (MobileNav) comutara adicionando classes `.mobile-view-*` */
    #chat-screen > #conversations-sidebar,
    #chat-screen > #right-panel {
        display: none;
    }
    #chat-screen.mobile-view-sidebar > #conversations-sidebar {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 40;
        background: var(--bg-primary);
        flex-direction: column;
    }
    #chat-screen.mobile-view-right > #right-panel {
        display: grid;
        grid-template-rows: 2fr 1fr;
        position: fixed;
        inset: 0;
        z-index: 40;
        background: var(--bg-primary);
    }
    #chat-screen.mobile-view-right > #right-panel > .tasks-panel,
    #chat-screen.mobile-view-right > #right-panel > .sales-chatbot {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }
}

/* =============================================================================
   Commit G — Reactions em mensagens
   ============================================================================= */

.message-reactions {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    align-items: center;
}

.reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #FFFFFF;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
}

.reaction-chip:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.reaction-chip:active {
    transform: scale(0.96);
}

.reaction-chip .reaction-count {
    font-size: 11px;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
}

.reaction-add {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px dashed var(--border-hover);
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: color 0.12s, border-color 0.12s, opacity 0.12s;
}

.message:hover .reaction-add {
    opacity: 1;
}

.reaction-add:hover {
    color: var(--accent);
    border-color: var(--accent);
    border-style: solid;
}

/* Picker: respeita o atributo hidden e usa tema claro quando visível */
.emoji-picker[hidden] {
    display: none !important;
}

.emoji-picker {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.reaction-preset {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.12s, transform 0.1s;
}

.reaction-preset:hover {
    background: var(--accent-soft);
    transform: scale(1.15);
}

/* =============================================================================
   Commit H — Thread pane + botão 💬 nas mensagens
   ============================================================================= */

.btn-thread {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    font-size: 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.12s, color 0.12s;
}

.btn-thread:hover {
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent, #00F0FF);
}

.btn-thread .thread-count {
    font-size: 11px;
    padding: 0 4px;
    background: rgba(0, 240, 255, 0.2);
    border-radius: 8px;
    color: var(--accent, #00F0FF);
    font-variant-numeric: tabular-nums;
}

.thread-pane {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    background: rgba(15, 15, 24, 0.96);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    color: inherit;
}

.thread-pane[hidden] { display: none; }

.thread-pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.thread-pane-head h3 {
    margin: 0;
    font-size: 15px;
}

.thread-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.12s, color 0.12s;
}

.thread-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.thread-parent {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.thread-parent-head {
    font-size: 12px;
    opacity: 0.75;
    margin-bottom: 4px;
}

.thread-parent-body {
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.thread-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.thread-count-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.6;
    margin: 0 0 8px;
}

.thread-replies {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.thread-reply {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}

.thread-reply-head {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
}

.thread-reply-time {
    opacity: 0.6;
}

.thread-reply-body {
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.thread-empty {
    opacity: 0.5;
    font-size: 13px;
    text-align: center;
    margin-top: 24px;
}

.thread-pane-foot {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.thread-pane-foot textarea {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    font-family: inherit;
    font-size: 14px;
    resize: none;
}

.thread-pane-foot textarea:focus {
    outline: none;
    border-color: var(--accent, #00F0FF);
}

.thread-send {
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    background: var(--accent, #00F0FF);
    color: #000;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.12s, transform 0.1s;
}

.thread-send:hover { filter: brightness(1.1); }
.thread-send:active { transform: scale(0.97); }

@media (max-width: 768px) {
    .thread-pane {
        width: 100vw;
        left: 0;
        right: 0;
    }
}

/* =============================================================================
   Commit I — Presence dots + typing banner
   ============================================================================= */

.conv-presence-dot {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary, #0f0f18);
    background: rgba(255, 255, 255, 0.25);
    pointer-events: none;
}

.conv-presence-dot.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.55);
}

.conv-presence-dot.away {
    background: #facc15;
}

.conv-presence-dot.offline {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(0, 0, 0, 0.2);
}

.typing-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(0, 240, 255, 0.06);
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    font-style: italic;
}

.typing-banner[hidden] { display: none; }

.typing-banner-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.typing-banner-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent, #00F0FF);
    animation: typing-dot 1s infinite ease-in-out;
}

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

@keyframes typing-dot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

/* =============================================================================
   Commit J — Attachments inline + lightbox + drag-drop
   ============================================================================= */

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.msg-attach {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    border-radius: 10px;
    overflow: hidden;
    max-width: 100%;
}

.msg-attach-image img {
    display: block;
    max-width: 400px;
    max-height: 320px;
    border-radius: 10px;
    cursor: zoom-in;
    transition: transform 0.15s;
}

.msg-attach-image img:hover {
    transform: scale(1.01);
}

.msg-attach-video {
    max-width: 500px;
    max-height: 360px;
    border-radius: 10px;
    background: #000;
}

.msg-attach-audio {
    width: 320px;
    max-width: 100%;
}

.msg-attach-file {
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    transition: background 0.12s, border-color 0.12s;
}

.msg-attach-file:hover {
    background: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.35);
}

.msg-attach-icon {
    font-size: 20px;
}

.msg-attach-name {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-attach-size {
    opacity: 0.55;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 32px;
}

.lightbox-overlay.open { display: flex; }

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.drop-zone-active {
    outline: 2px dashed var(--accent, #00F0FF);
    outline-offset: -8px;
    background: rgba(0, 240, 255, 0.05);
}

/* =============================================================================
   Commit K — Task shortcut from message
   ============================================================================= */

.btn-task-from-msg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
}

.btn-task-from-msg:hover {
    background: rgba(255, 200, 80, 0.15);
    color: #ffc850;
}

.task-shortcut-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 20px;
}

.task-shortcut-modal[hidden] { display: none; }

.task-shortcut-card {
    width: 100%;
    max-width: 480px;
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    color: inherit;
    overflow: hidden;
}

.task-shortcut-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.task-shortcut-head h3 {
    margin: 0;
    font-size: 15px;
}

.task-shortcut-close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.12s;
}

.task-shortcut-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.task-shortcut-form {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-shortcut-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.task-shortcut-field input[type="text"],
.task-shortcut-field input[type="date"],
.task-shortcut-field select,
.task-shortcut-form textarea {
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
}

.task-shortcut-field input:focus,
.task-shortcut-field select:focus,
.task-shortcut-form textarea:focus {
    outline: none;
    border-color: var(--accent, #00F0FF);
}

.task-shortcut-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.task-shortcut-form textarea {
    resize: vertical;
    min-height: 40px;
}

.task-shortcut-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.task-shortcut-cancel,
.task-shortcut-submit {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.task-shortcut-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
}

.task-shortcut-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
}

.task-shortcut-submit {
    background: var(--accent, #00F0FF);
    color: #000;
    transition: filter 0.12s, transform 0.1s;
}

.task-shortcut-submit:hover { filter: brightness(1.1); }
.task-shortcut-submit:active { transform: scale(0.97); }
.task-shortcut-submit:disabled { opacity: 0.6; cursor: wait; }

.task-shortcut-status {
    margin: 6px 0 0;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
}

.task-shortcut-status.success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.task-shortcut-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* =============================================================================
   Commit L — Read receipts em DMs ("✓✓ visto")
   ============================================================================= */

.msg-read-receipt {
    margin-top: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: rgba(34, 197, 94, 0.9);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-end;
    opacity: 0.85;
}

.msg-read-receipt-label {
    font-size: 10px;
    letter-spacing: 0.2px;
    text-transform: lowercase;
}

/* =============================================================================
   Commit N — @mentions: toast + autocomplete
   ============================================================================= */

/* Toast host (fixed top-right) */
.mention-toast-host {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1500;
    max-width: 360px;
    pointer-events: none;
}

.mention-toast {
    pointer-events: auto;
    background: rgba(20, 20, 30, 0.97);
    border: 1px solid rgba(255, 105, 180, 0.3);
    border-left: 3px solid var(--accent-secondary, #FF69B4);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    animation: mention-toast-in 0.25s ease-out;
    color: inherit;
    font-size: 13px;
}

.mention-toast.closing {
    animation: mention-toast-out 0.25s ease-in forwards;
}

@keyframes mention-toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes mention-toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

.mention-toast-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.mention-toast-icon { font-size: 15px; }

.mention-toast-project {
    color: var(--accent, #00F0FF);
    font-weight: 600;
}

.mention-toast-close {
    margin-left: auto;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s;
}
.mention-toast-close:hover { background: rgba(255, 255, 255, 0.08); }

.mention-toast-body {
    font-size: 12px;
    opacity: 0.88;
    margin-bottom: 8px;
    font-style: italic;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.mention-toast-actions {
    display: flex;
    justify-content: flex-end;
}

.mention-toast-goto {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    background: var(--accent, #00F0FF);
    color: #000;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.12s;
}
.mention-toast-goto:hover { filter: brightness(1.1); }

/* Autocomplete popup */
.mention-autocomplete {
    position: fixed;
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    overflow: hidden;
    z-index: 1400;
}

.mention-autocomplete[hidden] { display: none; }

.mention-ac-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.mention-ac-item:hover,
.mention-ac-item.selected {
    background: rgba(0, 240, 255, 0.12);
}

.mention-ac-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF69B4, #00F0FF);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.mention-ac-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mention-ac-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-ac-hint {
    font-size: 11px;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Colega virtual (bot) — destacado com glow accent */
.mention-ac-item-bot {
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.06), transparent);
}

.mention-ac-item-bot.selected,
.mention-ac-item-bot:hover {
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.22), rgba(255, 105, 180, 0.08));
}

.mention-ac-avatar-bot {
    background: radial-gradient(circle at 30% 30%, #00F0FF, #5eead4 45%, #FF69B4);
    color: #fff;
    font-size: 16px;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.mention-ac-bot-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6px;
    background: rgba(0, 240, 255, 0.22);
    color: var(--accent, #00F0FF);
    border-radius: 4px;
    vertical-align: 2px;
}

