/* ============================================================================== */
/* CONFIGURAÇÕES GERAIS                                                           */
/* ============================================================================== */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-color, #000000);
    color: var(--primary-text-color, #ffffff);
    transition: background-color 0.3s, color 0.3s;
}
#log-container { display: none; }

/* ============================================================================== */
/* Tela de boas vindas                                                            */
/* ============================================================================== */
:root {
    --bg-color: #000000;
    --primary-text-color: #ffffff;
    --secondary-text-color: #e6edf3;
    --tertiary-text-color: #d0d7de;
    --led-static-blue: #1E40AF;
    --neutral-line: #7d8590;
    --neutral-fill: #3d444d;
    --neutral-on: #e6edf3;
    --led-glow: rgba(30, 64, 175, 0.7);
    --loader-bar-bg: #22272e;
    --border-color: #30363d;
    --input-fill: #161616;
    --input-border: rgba(255,255,255,0.09);
    --send-bg: #2a2a2a;
    --ring-color: #1E40AF;
}

body.light-theme {
    --bg-color: #ffffff;
    --primary-text-color: #000000;
    --secondary-text-color: #333333;
    --tertiary-text-color: #555555;
    --led-static-blue: #0056b3;
    --neutral-line: #57606a;
    --neutral-fill: #d0d7de;
    --neutral-on: #24292f;
    --led-glow: rgba(0, 86, 179, 0.8);
    --loader-bar-bg: #e0e0e0;
    --border-color: #cccccc;
    --input-fill: #f2f3f5;
    --input-border: rgba(0,0,0,0.10);
    --send-bg: #d9d9dd;
    --ring-color: #0056b3;
}

/* ============================================================================== */
/* FORMAS GEOMETRICAS — cantos recortados FECHADOS (temas claro e escuro)          */
/*  O elemento vira a borda (cor do tema) com o recorte; o ::before (fundo) fica    */
/*  1px menor com o mesmo recorte, deixando um contorno fino que segue a diagonal.  */
/* ============================================================================== */
.bot-container .message-bubble,
.user-container .message-bubble,
.input-pill,
.history-search {
    position: relative;
    border: none !important;
    border-radius: 0 !important;
    background: var(--border-color) !important;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.bot-container .message-bubble::before,
.user-container .message-bubble::before,
.input-pill::before,
.history-search::before {
    content: ''; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
    clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%);
}
.bot-container .message-bubble::before { background: var(--bot-message-bg); }
.user-container .message-bubble::before { background: var(--user-message-bg); }
.input-pill::before { background: var(--input-fill); }
.history-search::before { background: var(--bot-message-bg); }

/* Barra lateral: mesmos cantos recortados (Nova Conversa, pastas, conversas) */
.history-item { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); }
.sp-newchat,
.hist-folder {
    position: relative;
    border: none !important;
    border-radius: 0 !important;
    background: var(--border-color) !important;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.sp-newchat::before,
.hist-folder::before {
    content: ''; position: absolute; inset: 1px; z-index: -1; pointer-events: none;
    clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%);
    background: var(--chat-header-bg);
}
.sp-newchat:hover::before { background: var(--component-hover-bg); }
html, body {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    overflow: hidden;
}

body {
    color: var(--primary-text-color);
    font-family: 'Poppins', sans-serif;
    transition: background-color 0.3s, color 0.3s;
    position: relative;
}

footer p {
    font-size: 1.2em !important;
    font-weight: bold;
    letter-spacing: 1px;
}

.view-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    transition: opacity 0.5s ease, visibility 0.5s;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.view-container.active-view {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 100;
}

.hidden-view {
    display: none !important;
}

#theme-switcher {
    position: absolute;
    top: 20px; right: 20px;
    cursor: pointer;
    display: flex;
    border: 1px solid #30363d;
    border-radius: 6px;
    background-color: #161616;
    transition: border-color 0.3s, background-color 0.3s;
    z-index: 20;
}
.theme-box { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
body.light-theme #theme-switcher, body.light-theme #intro-next { background-color: #f6f8fa; border-color: #d0d7de; }
#theme-switcher svg { width: 18px; height: 18px; fill: #7d8590; transition: fill 0.3s; }
body.light-theme #theme-switcher svg { fill: #57606a; }
#theme-switcher:hover svg { fill: #e6edf3; }
body.light-theme #theme-switcher:hover svg { fill: #24292f; }

#intro-next {
    position: absolute;
    top: 20px; right: 66px;
    cursor: pointer;
    display: flex;
    border: 1px solid #30363d;
    border-radius: 6px;
    background-color: #161616;
    transition: border-color 0.3s, background-color 0.3s;
    z-index: 20;
}
#intro-next svg { width: 18px; height: 18px; fill: #7d8590; transition: fill 0.3s; }
body.light-theme #intro-next svg { fill: #57606a; }
#intro-next:hover svg { fill: #e6edf3; }
body.light-theme #intro-next:hover svg { fill: #24292f; }
#intro-next:hover { border-color: var(--neutral-line); }

.dark-icon { display: none; }
.light-icon { display: block; }
body.light-theme .dark-icon { display: block; }
body.light-theme .light-icon { display: none; }

main { max-width: 600px; width: 100%; display: flex; flex-direction: column; align-items: center; }

.led-ring {
    width: 90px;
    height: 90px;
    margin-bottom: 30px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(30, 64, 175, 0.9)) drop-shadow(0 0 16px rgba(30, 64, 175, 0.45));
    transition: filter 0.4s ease;
}

.led-ring circle {
    stroke: #1E40AF; /* azul escuro fixo, nao muda com o tema */
    transition: stroke 0.4s ease;
}

/* Tema claro: sem dispersao de brilho — anel limpo como no tema escuro */
/* (brilho/dispersao do anel agora tambem no tema claro) */

/* Estados de cor do LED */
.led-ring.led-yellow circle { stroke: #FFB300; }
.led-ring.led-yellow { filter: drop-shadow(0 0 8px #FFB300) drop-shadow(0 0 20px rgba(255,179,0,0.6)); }

.led-ring.led-red circle { stroke: #FF4444; }
.led-ring.led-red { filter: drop-shadow(0 0 8px #FF4444) drop-shadow(0 0 20px rgba(255,68,68,0.6)); }

/* Animação de pulso (usado no loading) */
@keyframes ledPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

.led-ring.led-pulsing {
    animation: ledPulse 1.2s ease-in-out infinite;
    transform-origin: center;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5em);
    font-weight: bold;
    letter-spacing: 6px;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    text-shadow: 0 4px 15px rgba(0,0,0,0.9);
    line-height: 1.2;
}

body.light-theme h1 {
    color: #000000;
    text-shadow: none;
}

.p-main {
    font-size: clamp(0.85rem, 2.2vw, 1.4em);
    font-weight: 500;
    color: var(--secondary-text-color);
    line-height: 1.6;
    margin-bottom: 25px;
    min-height: 3.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9);
    padding: 0 20px;
    white-space: normal;
    overflow: visible;
    text-align: center;
    max-width: min(90%, 640px);
    margin-left: auto;
    margin-right: auto;
}
body.light-theme .p-main { text-shadow: 0 2px 4px rgba(255,255,255,0.9); }

body.light-theme .p-main { text-shadow: 0 2px 4px rgba(255,255,255,0.9); }

@media (max-width: 768px) {
    .p-main { white-space: normal; max-width: 90%; }
}

.loader-button-container {
    min-height: 80px;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    position: relative;
}

#loading-sequence { width: 100%; transition: opacity 0.4s ease-out, transform 0.4s ease-out; }
#loading-sequence.fade-out { opacity: 0; transform: scale(0.95); pointer-events: none; position: absolute; }

.loading-bar-container { width: 100%; height: 8px; border: 1px solid var(--border-color); background-color: var(--loader-bar-bg); border-radius: 4px; padding: 2px; box-sizing: border-box; }
.loading-bar-progress { width: 0%; height: 100%; background-color: var(--secondary-text-color); border-radius: 2px; animation: fill-bar 4s ease-out forwards; box-shadow: none; }

@keyframes fill-bar { from { width: 0%; } to { width: 100%; } }

.loading-text { color: var(--primary-text-color); margin-top: 15px; font-size: 1.1em; font-weight: bold; letter-spacing: 2px; text-transform: uppercase; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
body.light-theme .loading-text { text-shadow: none; }

#start-button {
    text-decoration: none;
    font-size: 1.5em;
    font-weight: bold;
    letter-spacing: 3px;
    color: var(--secondary-text-color);
    transition: all 0.3s;
    opacity: 0;
    position: absolute;
    pointer-events: none;
    border: none;
    padding: 15px 30px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    cursor: pointer;
    background: transparent;
    font-family: inherit;
}

body.light-theme #start-button { text-shadow: none; font-weight: 800; }
#start-button.fade-in { opacity: 1; pointer-events: auto; position: relative; }
#start-button:hover {
    color: var(--primary-text-color);
    text-shadow: none;
}
body.light-theme #start-button:hover { color: #000; }

footer { position: absolute; bottom: 20px; font-size: 0.8em; z-index: 20; padding: 0 20px; }
footer p { color: var(--tertiary-text-color); font-style: italic; font-family: 'Poppins', sans-serif; text-shadow: 0 1px 2px rgba(0,0,0,0.5); margin: 0; }
body.light-theme footer p { text-shadow: none; font-weight: bold; }

/* ============================================================================== */
/* Tela de Identificação                                                          */
/* ============================================================================== */
#view-auth {
    --panel-left-bg-dark: #0a0a0a;
    --panel-right-bg-dark: #161616;
    --primary-text-dark: #e6edf3;
    --secondary-text-dark: #7d8590;
    --input-border-dark: #30363d;
    --border-color-dark: #30363d;
    --icon-fill-dark: #7d8590;
    --button-gradient: linear-gradient(to right, #89CFF0, #0052D4);
    --button-text-color: #ffffff;
    --led-blue: #1E40AF;
    --led-blue-light: #1E40AF;
}

body.light-theme #view-auth {
    --panel-left-bg-dark: #ffffff;
    --panel-right-bg-dark: #f6f8fa;
    --primary-text-dark: #24292f;
    --secondary-text-dark: #57606a;
    --input-border-dark: #d0d7de;
    --border-color-dark: #d0d7de;
    --icon-fill-dark: #57606a;
}

#view-auth {
    background: var(--panel-left-bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
    z-index: 100 !important;
    pointer-events: auto;
    transition: background 0.3s, opacity 0.5s ease;
}

.top-right-controls { position: absolute; top: 20px; right: 20px; display: flex; align-items: center; gap: 12px; z-index: 30; }

.control-btn {
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color-dark); border-radius: 6px;
    background-color: var(--panel-right-bg-dark);
    transition: border-color 0.3s, background-color 0.3s;
    text-decoration: none; width: 32px; height: 32px;
}
.control-btn svg { width: 18px; height: 18px; fill: var(--icon-fill-dark); transition: fill 0.3s; }
.control-btn:hover svg { fill: var(--primary-text-dark); }

.login-card { display: flex; width: 850px; height: 550px; border-radius: 15px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.3); z-index: 25; }

.login-form-panel, .branding-panel { flex-basis: 50%; display: flex; flex-direction: column; justify-content: center; padding: 40px; transition: background-color 0.3s; }
.login-form-panel { background-color: var(--panel-left-bg-dark); padding: 60px; }
.branding-panel { background-color: var(--panel-right-bg-dark); align-items: center; }

#view-auth h2 { color: var(--primary-text-dark); font-size: 1.8em; font-weight: 600; margin: 0 0 30px 0; font-family: 'Poppins', sans-serif; }

.setup-label {
    display: block;
    color: var(--secondary-text-dark);
    font-size: 0.85em;
    margin-bottom: 8px;
    font-family: 'Poppins', sans-serif;
    text-align: left;
}

.setup-select {
    width: 100%;
    background: var(--panel-right-bg-dark);
    color: var(--primary-text-dark);
    border: 1px solid var(--input-border-dark);
    padding: 12px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 1em;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.3s;
    cursor: pointer;
}
.setup-select:focus { border-color: var(--neutral-line); }

.btn-start-research {
    width: 100%;
    padding: 16px;
    background: var(--primary-text-color);
    border: none;
    border-radius: 8px;
    color: var(--bg-color);
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: filter 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    font-family: 'Poppins', sans-serif;
    letter-spacing: 1px;
}
.btn-start-research:hover { filter: brightness(1.2); box-shadow: 0 0 25px rgba(137, 207, 240, 0.7); }

/* ---- Login: alternador visitante x conta ---- */
.hidden { display: none !important; }

.auth-tabs {
    display: flex;
    gap: 6px;
    background: var(--input-bg, rgba(127,127,127,0.08));
    border: 1px solid var(--border-color, rgba(127,127,127,0.25));
    border-radius: 10px;
    padding: 4px;
    margin: 4px 0 16px;
}
.auth-tab {
    flex: 1;
    padding: 9px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--secondary-text-color, #888);
    font-size: 0.86rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: background 0.22s, color 0.22s;
}
.auth-tab:hover { color: var(--primary-text-color); }
.auth-tab.active {
    background: var(--neutral-fill);
    color: var(--neutral-on);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

#auth-account .name-input { margin-bottom: 10px; }

.auth-switch {
    text-align: center;
    font-size: 0.82rem;
    color: var(--secondary-text-color, #888);
    margin: 4px 0 2px;
    font-family: 'Poppins', sans-serif;
}
.auth-switch a {
    color: var(--neutral-line);
    font-weight: 600;
    text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }


.error-message { color: #d93025; text-align: center; margin-top: 15px; display: none; font-size: 0.9em; font-family: 'Poppins', sans-serif; }

.brand-main-content { display: flex; flex-direction: column; align-items: center; gap: 20px; margin-bottom: auto; padding-top: 50px; }
.cyborg-title { color: var(--primary-text-dark); font-family: 'Times New Roman', Times, serif; font-size: 2.2em; letter-spacing: 4px; text-align: center; }

@media (max-width: 880px) {
    .login-card {
        flex-direction: column;
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        overflow-y: auto;
        justify-content: center; 
        gap: 8px;
    }
    .branding-panel {
        order: -1; 
        display: flex !important;
        flex-basis: auto;
        padding: 0 30px 8px;
        background-color: var(--panel-left-bg-dark) !important;
        justify-content: center;
        min-height: auto;
    }
    .brand-main-content {
        flex-direction: row;
        padding-top: 0;
        gap: 14px;
        margin-bottom: 0;
        align-items: center; 
        justify-content: center;
    }
    
    .branding-panel .led-ring {
        width: 48px;
        height: 48px;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .cyborg-title {
        font-size: 1.5em;
        line-height: 1; 
        margin: 0;
    }
    .login-form-panel {
        flex-basis: auto;
        padding: 16px 30px 24px;
        justify-content: center;
    }
}

/* ============================================================================== */
/* Tela de chat                                                                   */
/* ============================================================================== */
#view-chat {
    --chat-bg: #000000;
    --chat-header-bg: #111111;
    --bot-message-bg: #1e1e1e;
    --user-message-bg: #2f2f2f;
    --component-hover-bg: #444;
    --border-color: #333333;
    --icon-fill: #e0e0e0;
    --primary-text-color: #ffffff;
    --secondary-text-color: #b0b0b0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100dvh !important;
    max-height: -webkit-fill-available;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    z-index: 100;
    background-color: var(--chat-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.light-theme #view-chat {
    --chat-bg: #f5f5f5;
    --chat-header-bg: #ffffff;
    --bot-message-bg: #ffffff;
    --user-message-bg: #e0e0e0;
    --component-hover-bg: #d0d0d0;
    --border-color: #cccccc;
    --icon-fill: #333333;
    --primary-text-color: #000000;
    --secondary-text-color: #555555;
}

.cyborg-chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
}

.cyborg-chat-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: 100%;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    position: relative;
    overflow: hidden;
}

.chat-header {
    height: 60px;
    min-height: 60px;
    width: 100%;
    box-sizing: border-box;
    background-color: var(--chat-header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
    justify-content: space-between;
}

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

#sidebar-toggle-button {
    background: transparent; border: none; color: var(--icon-fill);
    cursor: pointer; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}
#sidebar-toggle-button:hover { background-color: var(--component-hover-bg); }

.brand-container { display: flex; align-items: center; gap: 10px; }

.cyborg-brand {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1.2em;
    letter-spacing: 2px;
    color: var(--primary-text-color);
    text-transform: uppercase;
    font-weight: bold;
}

.header-halo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 3px rgba(30, 64, 175, 0.9)) drop-shadow(0 0 7px rgba(30, 64, 175, 0.5));
    transition: filter 0.3s;
}

.header-halo circle {
    stroke: var(--ring-color); /* neutro */
    transition: stroke 0.4s ease;
}

.chat-history {
    flex-grow: 1;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    padding: 20px max(16px, calc((100% - 820px) / 2));
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.input-area {
    width: 100%;
    box-sizing: border-box;
    background-color: var(--chat-bg);
    padding: 10px 20px 18px;
    display: flex;
    justify-content: center;
    z-index: 20;
    position: relative;
    transition: padding 0.3s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.input-area.expanded {
    position: absolute;
    top: 64px;          /* logo abaixo do header */
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;    /* neutraliza o deslocamento do estado landing */
    width: auto;
    max-width: none;
    height: auto;
    background: var(--bg-color);   /* opaco: cobre o chat atrás, sem overlay separado */
    padding: 16px 16px 18px;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
/* mesmo no estado inicial (landing), a expansão preenche a área do chat */
.cyborg-chat-container.landing .input-area.expanded { transform: none; }
.input-pill {
    width: 100%;
    max-width: 820px;
    background-color: var(--input-fill);
    border: 1px solid var(--input-border);
    border-radius: 20px;
    padding: 7px 8px 7px 18px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    box-shadow: none;
    transition: border-color 0.25s, background-color 0.25s;
}
.input-pill:focus-within {
    border-color: var(--border-color);
    box-shadow: none;
}
.input-area.expanded .input-pill {
    height: min(58vh, 500px);
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.35);
    align-items: flex-start;
    padding: 14px;
}
.input-area.expanded #user-input { max-height: none; }
#user-input {
    flex: 1;
    background: transparent;
    color: var(--primary-text-color);
    border: none;
    padding: 6px 0;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    min-height: 30px;
    max-height: 200px;
    overflow-y: auto;
    outline: none;
    line-height: 1.5;
    scrollbar-width: thin;
    scrollbar-color: rgba(127,127,127,0.45) transparent;
}
#user-input::-webkit-scrollbar { width: 6px; }
#user-input::-webkit-scrollbar-thumb { background: rgba(127,127,127,0.45); border-radius: 3px; }
#user-input::-webkit-scrollbar-track { background: transparent; }
/* fade no fim do campo quando o texto passa do limite (estilo ChatGPT) */
.input-pill { position: relative; }
.input-pill.has-scroll::after {
    content: '';
    position: absolute;
    left: 14px; right: 58px; bottom: 10px; height: 22px;
    background: linear-gradient(to top, var(--bot-message-bg), transparent);
    pointer-events: none;
    border-radius: 0 0 12px 12px;
}
.input-area.expanded .input-pill.has-scroll::after { display: none; }
.input-area.expanded #user-input {
    min-height: 100%;
    max-height: none;
}
.input-actions {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    padding-bottom: 2px;
}
.input-area.expanded .input-actions {
    align-items: flex-start;
    padding-bottom: 0;
    padding-top: 2px;
}
#expand-button {
    background: transparent;
    border: none;
    color: var(--secondary-text-color);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
}
#expand-button:hover {
    background-color: var(--component-hover-bg);
    color: var(--primary-text-color);
}
/* Botao de microfone (entrada por voz) */
#mic-button {
    background: transparent; border: none; color: var(--secondary-text-color);
    cursor: pointer; width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background-color 0.2s, color 0.2s; flex-shrink: 0; position: relative;
}
#mic-button:hover { background-color: var(--component-hover-bg); color: var(--primary-text-color); }
#mic-button.is-listening { color: #ff2e63; }
#mic-button .ico-mic-stop { display: none; align-items: center; justify-content: center; }
#mic-button.is-listening .ico-mic { display: none; }
#mic-button.is-listening .ico-mic-stop { display: inline-flex; }

/* Overlay de gravacao no campo (onda sonora + tempo), estilo ChatGPT */
.voice-overlay {
    display: none; position: absolute; left: 18px; right: 84px; top: 0; bottom: 0;
    align-items: center; gap: 12px; pointer-events: none;
}
.input-pill.is-recording .voice-overlay { display: flex; }
.input-pill.is-recording #user-input { opacity: 0; }
.voice-wave { display: inline-flex; align-items: center; gap: 3px; height: 24px; }
.voice-wave i {
    width: 3px; height: 6px; border-radius: 2px; display: inline-block;
    background: var(--led-static-blue); animation: voiceBar 1s ease-in-out infinite;
}
.voice-wave i:nth-child(2n) { animation-delay: .12s; }
.voice-wave i:nth-child(3n) { animation-delay: .28s; }
.voice-wave i:nth-child(4n) { animation-delay: .42s; }
.voice-wave i:nth-child(5n) { animation-delay: .6s; }
@keyframes voiceBar { 0%, 100% { height: 5px; } 50% { height: 22px; } }
.voice-timer { font-size: 0.85rem; color: var(--secondary-text-color); font-variant-numeric: tabular-nums; }

/* Aviso curto (toast) para o sistema de voz */
#cyborg-toast {
    position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(12px);
    max-width: 86%; z-index: 6000; pointer-events: none;
    background: rgba(20, 22, 28, 0.96); color: #fff; border: 1px solid rgba(255,255,255,0.12);
    padding: 11px 16px; border-radius: 12px; font-size: 0.86rem; line-height: 1.35; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease;
}
#cyborg-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#send-button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--send-bg);
    border: none;
    color: var(--primary-text-color);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    transition: background-color 0.25s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1), filter 0.2s;
    position: relative;
}
#send-button:hover { filter: brightness(1.15); }
#send-button .ico-send, #send-button .ico-stop {
    display: inline-flex; align-items: center; justify-content: center;
    transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
    position: absolute;
}
#send-button .ico-stop { opacity: 0; transform: scale(0.3) rotate(-90deg); }
#send-button .ico-send { opacity: 1; transform: scale(1) rotate(0deg); }
/* estado "gerando": vira botao de interromper com efeito de mudanca de forma */
#send-button.is-stop { background-color: var(--neutral-fill); }
#send-button.is-stop .ico-send { opacity: 0; transform: scale(0.3) rotate(90deg); }
#send-button.is-stop .ico-stop { opacity: 1; transform: scale(1) rotate(0deg); animation: stopPulse 1.3s ease-in-out infinite; }
@keyframes stopPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(125,133,144,0.5); } 50% { box-shadow: 0 0 0 5px rgba(125,133,144,0); } }

.message-container { display: flex; flex-direction: column; max-width: 85%; }
.bot-container { align-self: flex-start; }
.user-container { align-self: flex-end; align-items: flex-end; }

.message-meta {
    font-size: 0.75em; color: var(--secondary-text-color);
    margin-bottom: 5px; margin-left: 5px;
    display: flex; align-items: center; gap: 8px;
}

.message-bubble {
    padding: 15px 20px 25px 20px;
    border-radius: 15px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    color: var(--primary-text-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    word-wrap: break-word;
}

.bot-container .message-bubble {
    background-color: var(--bot-message-bg);
    border: 1px solid var(--border-color);
    border-top-left-radius: 2px;
}
.user-container .message-bubble {
    background-color: var(--user-message-bg);
    border: 1px solid var(--border-color);
    border-top-right-radius: 2px;
}

.message-time {
    position: absolute; bottom: 5px; right: 10px;
    font-size: 0.65em; opacity: 0.6;
}

.side-panel {
    position: absolute; top: 0; left: 0;
    width: 320px; height: 100%;
    background-color: var(--chat-header-bg);
    border-right: 1px solid var(--border-color);
    z-index: 2000;
    transform: translateX(-100%);
    opacity: 0.35;
    box-shadow: none;
    transition: transform 0.44s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.30s ease,
                box-shadow 0.44s ease;
    display: flex; flex-direction: column;
    will-change: transform, opacity;
}
.side-panel.is-open { transform: translateX(0); opacity: 1; box-shadow: 14px 0 44px rgba(0, 0, 0, 0.45); }

.side-panel-header {
    height: 58px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px;
    color: var(--primary-text-color);
}
.side-panel-header .sp-brand { display: flex; align-items: center; gap: 10px; }
.side-panel-header .cyborg-brand { font-size: 1.02em; }
.side-panel-header .header-halo { width: 20px; height: 20px; }
.side-panel-body { padding: 10px 8px; overflow-y: auto; }

    .menu-item {
        width: 100%; background: transparent; border: none;
        color: var(--primary-text-color); padding: 11px 12px;
        text-align: left; cursor: pointer;
        display: flex; align-items: center; gap: 12px;
        border-radius: 8px; margin-bottom: 2px;
        font-family: inherit; font-size: 0.95rem; font-weight: 500;
        transition: background-color 0.15s ease;
    }
    .menu-item:hover { background-color: var(--component-hover-bg); }
    .menu-item svg {
        width: 20px; height: 20px; min-width: 20px;
        flex-shrink: 0; fill: currentColor; opacity: 0.85;
    }
    /* separador sutil entre os itens do menu lateral */
    .side-panel-body .menu-item { position: relative; margin-bottom: 0; }
    .side-panel-body .menu-item:not(:last-child)::after {
        content: '';
        position: absolute;
        left: 12px; right: 12px; bottom: 0;
        height: 1px;
        background: var(--border-color);
        opacity: 0.45;
        pointer-events: none;
    }

#sidebar-close-button {
    background: transparent; border: none; color: var(--icon-fill); cursor: pointer;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; padding: 0; transition: background 0.15s;
}
#sidebar-close-button:hover { background: var(--component-hover-bg); }
.ham { position: relative; width: 22px; height: 16px; display: block; }
.ham-bar {
    position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px;
    background: currentColor;
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.22s ease, top 0.32s ease;
}
/* tres riscos sempre: o mesmo icone que abre tambem fecha */
.ham-bar:nth-child(1) { top: 0; }
.ham-bar:nth-child(2) { top: 7px; }
.ham-bar:nth-child(3) { top: 14px; }
/* micro-interacao ao tocar: as barras se aproximam de leve */
#sidebar-close-button:active .ham-bar:nth-child(1) { top: 2px; }
#sidebar-close-button:active .ham-bar:nth-child(3) { top: 12px; }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 3000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.32s ease, visibility 0.32s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }

.modal-box {
    background-color: var(--chat-header-bg);
    border: 1px solid var(--border-color);
    width: 600px; max-width: 90%; padding: 25px;
    border-radius: 10px; color: var(--primary-text-color);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}
.modal-title { color: var(--primary-text-color); font-weight: bold; text-transform: uppercase; }
.close-modal { background: none; border: none; color: var(--secondary-text-color); font-size: 1.5em; cursor: pointer; }

@keyframes slideFromRight { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes slideFromLeft  { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
@keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }


.history-list-container {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 15px;
    padding-right: 5px;
}

.history-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--primary-text-color);
    transition: background 0.2s;
    border-radius: 6px;
    margin-bottom: 4px;
}
.history-item:hover { background-color: var(--component-hover-bg); }
.history-item.active-chat { background-color: rgba(125, 133, 144, 0.14); border-left: 3px solid var(--neutral-line); }

.history-title {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95em;
    cursor: pointer;
    margin-right: 10px;
}

.history-actions {
    display: flex;
    gap: 5px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.history-item:hover .history-actions { opacity: 1; }

.btn-icon-hist {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--secondary-text-color);
    display: flex; align-items: center; justify-content: center;
}
.btn-icon-hist:hover { background-color: rgba(255,255,255,0.1); color: var(--primary-text-color); }

.btn-pin.pinned { color: var(--neutral-line); }
.btn-delete:hover { color: #ff4444; }

.history-search { width: 100%; padding: 12px; background: var(--bot-message-bg); border: 1px solid var(--border-color); color: var(--primary-text-color); border-radius: 8px; box-sizing: border-box; outline: none; }
.history-search:focus { border-color: var(--neutral-line); }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-bubble.fade-in {
    animation: fadeInUp 0.6s ease-out forwards;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--secondary-text-color);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes ledLoadPulse {
    0%, 100% { transform: scale(1);    opacity: 0.6; }
    50%      { transform: scale(1.14); opacity: 1;   }
}
.led-loading {
    width: 24px; height: 24px;   /* um pouco maior: as particulas ficam legiveis */
    transform-origin: center;
    /* sem pulsar: quem da vida ao anel sao as particulas cintilando */
    filter: drop-shadow(0 0 4px rgba(255, 179, 0, 0.8)) drop-shadow(0 0 9px rgba(255, 179, 0, 0.4));
    transition: filter 0.6s ease;
}
/* carregando: o anel solido some e dá lugar a um anel de PARTICULAS amarelas */
.led-loading .led-ring-base {
    stroke: #FFB300 !important;  /* amarelo enquanto processa */
    opacity: 0.30;               /* fraco: segura a FORMA do anel */
    transition: opacity 0.45s ease, stroke 0.5s ease;
}
.led-loading .led-parts {
    opacity: 1;
    transition: opacity 0.40s ease;
}
.led-loading .led-parts circle {
    fill: #FFB300;
    stroke: none;               /* nao herda o contorno azul do .header-halo circle */
    animation: partCintila 1.3s ease-in-out infinite alternate;
}
@keyframes partCintila {
    from { opacity: 0.18; }
    to   { opacity: 1; }
}
/* resposta pronta: as particulas se dissolvem e o anel azul inteiro reaparece */
.led-loading.led-done .led-parts { opacity: 0; }
.led-loading.led-done .led-ring-base { opacity: 1; stroke: var(--ring-color) !important; }
.led-loading.led-done {
    animation: none;
    transform: none;
    filter: drop-shadow(0 0 3px rgba(30, 64, 175, 0.95)) drop-shadow(0 0 7px rgba(30, 64, 175, 0.6));
    transition: filter 0.6s ease;
}
.led-loading.led-done .led-ring-base {
    stroke: var(--ring-color);
    transition: opacity 0.45s ease, stroke 0.6s ease;
}
.led-loading.led-error {
    animation: none;
    transform: none;
    filter: drop-shadow(0 0 3px #FF4444) drop-shadow(0 0 7px rgba(255,68,68,0.5));
}
.led-loading.led-error .led-parts circle { fill: #FF4444; animation: none; opacity: 0.95; }
.led-loading.led-error .led-parts { opacity: 1; }
.led-loading.led-error .led-ring-base { stroke: #FF4444 !important; opacity: 1; }
.typing-cursor::after {
    content: '▌';
    animation: cursorBlink 0.6s step-end infinite;
    color: var(--led-static-blue);
    font-size: 0.9em;
    margin-left: 1px;
}
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

.header-right {
    width: 40px;
    flex-shrink: 0;
}

.auth-subtitle {
    color: var(--secondary-text-dark);
    font-size: 0.9em;
    margin: 0 0 24px 0;
    font-family: 'Poppins', sans-serif;
    line-height: 1.5;
    font-style: italic;
}

.name-input {
    width: 100%;
    background: var(--panel-right-bg-dark);
    color: var(--primary-text-dark);
    border: 1px solid var(--input-border-dark);
    padding: 14px 16px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 1em;
    outline: none;
    box-sizing: border-box;
    margin-bottom: 20px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.name-input:focus {
    border-color: var(--neutral-line);
    box-shadow: 0 0 0 3px rgba(125, 133, 144, 0.15);
}

.name-input::placeholder {
    color: var(--secondary-text-dark);
    opacity: 0.6;
}

body.light-theme .modal-box .slide h3,
body.light-theme .modal-box .slide p,
body.light-theme .modal-box .slide li,
body.light-theme .modal-box .slide strong {
    color: #000000 !important;
}

/* ============================================================================== */
/* Configurações / RAG — toggle exclusivo da versão LLM                           */
/* ============================================================================== */
.config-row { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; gap: 20px; border-bottom: 1px solid var(--border-color); }
.switch { position: relative; display: inline-block; width: 50px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition: .4s; border-radius: 34px; border: 1px solid var(--border-color); }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; top: 50%; transform: translateY(-50%); background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--neutral-fill); }
input:checked + .slider:before { transform: translateY(-50%) translateX(26px); }
/* ============================================================================== */
/* Esconde as barras de rolagem (mantendo a rolagem funcional)                    */
/* ============================================================================== */
.side-panel-body,
.history-list-container,
.modal-content {
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE / Edge antigo */
}
.side-panel-body::-webkit-scrollbar,
.history-list-container::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;                /* Chrome / Safari / Edge */
}


/* ============================================================================== */
/* Barra de rolagem do chat: fina, arredondada, aparece so ao passar o mouse       */
/* ============================================================================== */
.chat-history {
    scrollbar-width: thin;                        /* Firefox */
    scrollbar-color: transparent transparent;     /* invisivel por padrao */
    transition: scrollbar-color 0.3s ease;
}
.chat-history:hover {
    scrollbar-color: rgba(255,255,255,0.20) transparent;
}
.chat-history::-webkit-scrollbar {
    width: 10px;
}
.chat-history::-webkit-scrollbar-track {
    background: transparent;
}
.chat-history::-webkit-scrollbar-thumb {
    background-color: transparent;                /* some ate o hover */
    border-radius: 10px;
    border: 3px solid transparent;                /* inset: thumb fininho e flutuante */
    background-clip: padding-box;
    transition: background-color 0.3s ease;
}
.chat-history:hover::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.16);
}
.chat-history::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255,255,255,0.32);
}
/* Tema claro: thumb escuro sutil */
body.light-theme .chat-history:hover {
    scrollbar-color: rgba(0,0,0,0.22) transparent;
}
body.light-theme .chat-history:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.16);
}
body.light-theme .chat-history::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0,0,0,0.32);
}


/* ============================================================================== */
/* Painel admin (modal in-app)                                                    */
/* ============================================================================== */
.hidden-admin { display: none !important; }
.admin-label { font-size: 0.85em; color: var(--secondary-text-color); margin-bottom: 8px; }
.pw-wrap { position: relative; }
.admin-input {
    width: 100%; box-sizing: border-box;
    background: var(--chat-bg); color: var(--primary-text-color);
    border: 1px solid var(--border-color); border-radius: 8px;
    padding: 13px 46px 13px 14px; font-family: inherit; font-size: 1em; outline: none;
}
.admin-input:focus { border-color: var(--neutral-line); }
.eye {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; color: var(--secondary-text-color);
    cursor: pointer; padding: 6px; display: flex; align-items: center;
}
.eye:hover { color: var(--neutral-line); }
.btn-admin-primary {
    width: 100%; margin-top: 16px; padding: 13px; background: var(--neutral-fill);
    color: var(--neutral-on); border: none; border-radius: 8px; font-family: inherit;
    font-weight: bold; letter-spacing: 1px; cursor: pointer;
}
.btn-admin-primary:hover { filter: brightness(1.1); }
.btn-admin-danger {
    width: 100%; margin-top: 10px; padding: 12px; background: transparent;
    color: #ff6b6b; border: 1px solid #ff6b6b; border-radius: 8px; font-family: inherit;
    font-weight: bold; letter-spacing: 1px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-admin-danger:hover { background: rgba(255,107,107,0.12); }
.btn-admin-danger svg { width: 18px; height: 18px; fill: currentColor; }
.admin-err { color: #ff6b6b; font-size: 0.85em; margin-top: 12px; min-height: 18px; text-align: center; }
.admin-toast { text-align: center; font-size: 0.8em; color: var(--secondary-text-color); margin-top: 14px; min-height: 16px; }
.admin-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 22px; }
.admin-stat { background: var(--chat-bg); border: 1px solid var(--border-color); border-radius: 10px; padding: 14px; text-align: center; }
.admin-stat .n { font-size: 1.5em; color: var(--led-static-blue); }
.admin-stat .l { font-size: 0.7em; color: var(--secondary-text-color); text-transform: uppercase; letter-spacing: 1px; }

/* ============================================================================== */
/* Painel admin — estatísticas e conversas                                        */
/* ============================================================================== */
.btn-admin-secondary { width:100%; margin-top:22px; padding:13px; background:transparent; color:var(--neutral-line); border:1px solid var(--neutral-line); border-radius:8px; font-family:inherit; font-weight:bold; letter-spacing:1px; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:8px; }
.btn-admin-secondary:hover { background:rgba(125,133,144,0.12); }
.btn-admin-secondary svg { width:18px; height:18px; fill:currentColor; }
.admin-subtitle { margin:20px 0 10px; font-size:0.85em; color:var(--secondary-text-color); text-transform:uppercase; letter-spacing:1px; }
.admin-list { max-height:320px; overflow-y:auto; display:flex; flex-direction:column; gap:8px; padding-right:4px; }
.admin-list-item { background:var(--chat-bg); border:1px solid var(--border-color); border-radius:8px; padding:12px; cursor:pointer; transition:border-color .2s; }
.admin-list-item:hover { border-color:var(--neutral-line); }
.ali-top { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.ali-user { font-weight:bold; color:var(--primary-text-color); }
.ali-count { font-size:0.72em; color:var(--led-static-blue); flex-shrink:0; }
.ali-sub { font-size:0.72em; color:var(--secondary-text-color); margin-top:3px; }
.ali-title { font-size:0.85em; color:var(--secondary-text-color); margin-top:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.admin-empty { text-align:center; color:var(--secondary-text-color); padding:18px; font-size:0.85em; }
.admin-msg { border-radius:8px; padding:10px 12px; border:1px solid var(--border-color); }
.admin-msg-user { background:var(--user-message-bg); }
.admin-msg-bot { background:var(--bot-message-bg); }
.am-role { font-size:0.72em; color:var(--secondary-text-color); margin-bottom:4px; }
.am-text { font-size:0.9em; color:var(--primary-text-color); white-space:pre-wrap; word-break:break-word; }

/* ============================================================================== */
/* Tela de boas-vindas do chat (mensagem central, anel à esquerda)                */
/* ============================================================================== */
.chat-welcome {
    position: absolute;
    top: 60px; left: 0; right: 0; bottom: 92px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 0 8%;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 5;
}
.chat-welcome.active { display: flex; }
.chat-welcome .cw-ring {
    width: 60px; height: 60px; flex-shrink: 0;
    filter: drop-shadow(0 0 8px var(--led-static-blue)) drop-shadow(0 0 20px var(--led-glow));
}
.chat-welcome .cw-ring circle { stroke: var(--led-static-blue); }
.chat-welcome .cw-text {
    font-size: clamp(1.3rem, 3.2vw, 2.3rem);
    font-weight: 500;
    color: var(--primary-text-color);
    line-height: 1.35;
    max-width: 620px;
}
@media (max-width: 600px) {
    .chat-welcome { flex-direction: column; text-align: center; gap: 14px; bottom: 104px; padding: 0 16px; }
    .chat-welcome .cw-text { font-size: clamp(1rem, 4.6vw, 1.4rem); line-height: 1.4; max-width: 100%; }
}


/* ============================================================================== */
/* Seleção de idioma                                                              */
/* ============================================================================== */
.lang-option {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    background: transparent; border: 1px solid var(--border-color); border-radius: 8px;
    color: var(--primary-text-color); padding: 14px 16px; margin-bottom: 10px;
    font-family: inherit; font-size: 1em; cursor: pointer; transition: border-color .2s, color .2s, background .2s;
}
.lang-option:hover { background: var(--component-hover-bg); }
.lang-option.active { border-color: var(--neutral-line); color: var(--neutral-line); }
.lang-option .lang-check { opacity: 0; color: var(--neutral-line); font-weight: bold; }
.lang-option.active .lang-check { opacity: 1; }

/* ============================================================================== */
/* Transição da barra lateral: fundo escurecido + entrada escalonada dos itens    */
/* ============================================================================== */
.sidebar-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0; visibility: hidden;
    transition: opacity 0.36s ease, visibility 0.36s;
    z-index: 1999;
}
.side-panel.is-open ~ .sidebar-backdrop { opacity: 1; visibility: visible; }

.side-panel.is-open .side-panel-top,
.side-panel.is-open .side-panel-history,
.side-panel.is-open .side-panel-footer {
    animation: spConteudoIn 0.46s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.side-panel.is-open .side-panel-top { animation-delay: 0.07s; }
.side-panel.is-open .side-panel-history { animation-delay: 0.13s; }
.side-panel.is-open .side-panel-footer { animation-delay: 0.19s; }
@keyframes spConteudoIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes sidebarItemIn {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}


/* Abertura/fechamento elegante da caixa dos modais (subtelinhas) */
.modal-box {
    transform: translateY(26px) scale(0.96);
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
.modal-overlay.active .modal-box {
    transform: translateY(0) scale(1);
    opacity: 1;
}


/* ==== Aparicao suave da mensagem (fade + leve subida + desfoque saindo) ==== */
@keyframes msgAppear {
    from { opacity: 0; transform: translateY(8px); filter: blur(6px); }
    to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}
.message-bubble.msg-appear { animation: msgAppear 0.5s ease-out both; }

/* ==== Markdown: citacoes em italico, blockquote, tabelas responsivas ==== */
.message-bubble em { font-style: italic; opacity: 0.96; }
.message-bubble blockquote {
    margin: 8px 0; padding: 4px 12px;
    border-left: 3px solid var(--led-static-blue);
    color: var(--secondary-text-color); font-style: italic;
}
.message-bubble table {
    border-collapse: separate; border-spacing: 0; margin: 14px 0; width: 100%;
    font-size: 0.9em; display: block; overflow-x: auto;
    border: 1px solid var(--border-color); border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.14);
    -webkit-overflow-scrolling: touch;
}
.message-bubble th, .message-bubble td {
    padding: 10px 15px; text-align: left; line-height: 1.45;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color); white-space: nowrap;
}
.message-bubble tr td:last-child, .message-bubble tr th:last-child { border-right: none; }
.message-bubble tbody tr:last-child td { border-bottom: none; }
.message-bubble thead th {
    background: var(--user-message-bg); color: var(--primary-text-color);
    font-weight: 700; border-bottom: 2px solid var(--led-static-blue);
    text-transform: uppercase; font-size: 0.78em; letter-spacing: 0.5px;
}
.message-bubble tbody tr:nth-child(even) { background: rgba(127,127,127,0.05); }
.message-bubble tbody tr { transition: background 0.15s ease; }
.message-bubble tbody tr:hover { background: rgba(30, 64, 175, 0.10); }
.message-bubble code {
    background: var(--bot-message-bg); padding: 1px 5px; border-radius: 4px;
    font-family: ui-monospace, 'Courier New', monospace; font-size: 0.9em;
}
.message-bubble pre {
    background: var(--bot-message-bg); border: 1px solid var(--border-color);
    border-radius: 10px; padding: 12px 14px; margin: 12px 0; overflow-x: auto;
    font-family: ui-monospace, 'Courier New', monospace; font-size: 0.86em; line-height: 1.5;
}
.message-bubble pre code {
    background: none; padding: 0; border-radius: 0; font-size: 1em; white-space: pre;
}


/* ============================================================================== */
/* Titulo "CYBORG AI" que se desenha sozinho (letra a letra)                       */
/* ============================================================================== */
.brand { margin: 0; line-height: 1; }
.brand-svg { width: min(72vw, 460px); height: auto; display: block; margin: 0 auto; overflow: visible; }
.brand-text { font-family: 'Times New Roman', Times, serif; font-size: 60px; letter-spacing: 6px; }
.brand-text tspan {
    fill: var(--primary-text-color);
    stroke: var(--primary-text-color);
    stroke-width: 1.1;
    stroke-dasharray: 240;
    stroke-dashoffset: 0;
    fill-opacity: 1;
    paint-order: stroke;
    animation: brandInk 1.45s ease both;
}
@keyframes brandInk {
    0%   { stroke-dashoffset: 240; fill-opacity: 0; }
    55%  { stroke-dashoffset: 0;   fill-opacity: 0; }
    100% { stroke-dashoffset: 0;   fill-opacity: 1; }
}

/* Transicao suave entre as frases rotativas da tela inicial */
#view-intro .p-main { transition: opacity 0.55s ease, color 0.3s ease; }

@media (prefers-reduced-motion: reduce) {
    .brand-text tspan { animation: none; fill-opacity: 1; stroke-dashoffset: 0; }
}


/* ============================================================================== */
/* Surgimento do anel (logo) na tela inicial: ele surge (aparece) suavemente            */
/* ============================================================================== */
#view-intro .led-ring {
    animation: ringAppear 0.85s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    transform-origin: center;
}
@keyframes ringAppear {
    0%   { opacity: 0; transform: scale(0.3); }
    100% { opacity: 1; transform: scale(1); }
}


/* ============================================================================== */
/* Orbe de particulas da tela inicial (azul escuro fixo, canvas)                   */
/* ============================================================================== */
#intro-orb-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}
#view-intro main { position: relative; z-index: 10; }
.intro-orb-anchor {
    width: clamp(150px, 34vw, 200px);
    height: clamp(150px, 34vw, 200px);
    margin-bottom: 30px;
    flex-shrink: 0;
}


/* ==== Rastro de particulas no anel de carregamento do chat ==== */
.loader-ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; }
.loader-ring-wrap .led-loading { position: relative; z-index: 2; }
.loader-parts { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; transform: translate(-50%, -50%); pointer-events: none; z-index: 1; }


/* ==== Pulso lento e sutil do anel (login/chat) ==== */
@keyframes ringPulse {
    0%, 100% { transform: scale(1);     opacity: 1;    }
    50%      { transform: scale(1.014); opacity: 0.96; }
}
.led-ring { animation: ringPulse 6.5s ease-in-out infinite; transform-origin: center; }


/* ==== Fade do rodape do chat: degrade fixo acima do campo (robusto, sem cortar a barra) ==== */
.input-area::before {
    content: "";
    position: absolute;
    left: 0; right: 0;
    bottom: 100%;
    height: 46px;
    background: linear-gradient(to top, var(--chat-bg), transparent);
    pointer-events: none;
}
.input-area.expanded::before { display: none; }

/* horario nao aparece na bolha (continua no banco/CSV) */
.message-time { display: none !important; }


/* ==== Estado inicial estilo ChatGPT: campo no meio + mensagem acima (chat vazio) ==== */
.chat-landing { display: none; }
.cyborg-chat-container.landing .chat-landing {
    display: block; pointer-events: none;
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
.cyborg-chat-container.landing .input-area::before { display: none; }
#chat-landing-text {
    font-family: 'Poppins', sans-serif; font-weight: 600;
    font-size: clamp(1.02rem, 3vw, 1.55rem); color: var(--primary-text-color);
    text-shadow: 0 2px 6px rgba(0,0,0,0.5); line-height: 1.4; display: inline-block; max-width: 90%;
}

/* ==== Telas grandes: layout centralizado (mensagem + campo no meio) ==== */
@media (min-width: 900px) {
    /* saudacao FIXA no meio-superior: nao se move quando o campo cresce */
    .cyborg-chat-container.landing .chat-landing {
        position: absolute; left: 0; right: 0; top: 34vh;
        text-align: center; padding: 0 20px; transform: none; z-index: 5;
    }
    .cyborg-chat-container.landing .input-area { transform: translateY(-40vh); }
    /* no estado inicial (campo no meio) o icone de expandir nao aparece */
    .cyborg-chat-container.landing #expand-button { display: flex; }
    .chat-history { padding-left: max(16px, calc((100% - 820px) / 2)); padding-right: max(16px, calc((100% - 820px) / 2)); }
}

/* ==== Telas pequenas: sem centralizar; saudacao no topo a esquerda, campo embaixo ==== */
@media (max-width: 899px) {
    /* celular: sem layout centralizado. Saudacao no topo (fluxo normal), campo colado embaixo */
    .cyborg-chat-container.landing .chat-history { flex: 0 0 auto; }
    .cyborg-chat-container.landing .chat-landing {
        transform: none; text-align: left; padding: 14px 16px;
    }
    .cyborg-chat-container.landing .input-area { transform: none; margin-top: auto; }
    #chat-landing-text { text-shadow: none; font-size: 1rem; max-width: 100%; }
}

/* ==== Sidebar full-width no celular (estilo ChatGPT) ==== */
@media (max-width: 768px) {
    .side-panel { width: 100%; max-width: 100%; border-right: none; }
}


/* ==== Pastas no histórico ==== */
.hist-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.hist-toolbar .history-search { margin: 0; flex: 1; }
.btn-new-folder {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; color: var(--primary-text-color);
    border: 1px solid var(--border-color); border-radius: 8px;
    padding: 8px 12px; cursor: pointer; font-family: inherit; font-size: 0.85rem;
    white-space: nowrap; transition: background-color 0.15s, border-color 0.15s;
}
.btn-new-folder:hover { background-color: var(--component-hover-bg); border-color: var(--neutral-line); }
.btn-new-folder svg { fill: var(--led-static-blue); }
.sp-link-folder svg { fill: var(--led-static-blue); }

.hist-folder { border: 1px solid var(--border-color); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.hist-folder-head {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 10px; cursor: pointer;
    background: rgba(127,127,127,0.06);
    transition: background-color 0.15s;
}
.hist-folder-head:hover { background: rgba(127,127,127,0.12); }
.folder-caret { transition: transform 0.2s ease; opacity: 0.7; }
.folder-caret.open { transform: rotate(90deg); }
.hist-folder-name { font-weight: 600; font-size: 0.9rem; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-folder-count {
    font-size: 0.72rem; opacity: 0.7; background: rgba(127,127,127,0.18);
    border-radius: 10px; padding: 1px 8px; margin-left: 2px;
}
.hist-folder-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.hist-folder-head:hover .hist-folder-actions { opacity: 1; }
.hist-folder-body { padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.hist-folder-body.collapsed { display: none; }
.hist-folder-empty { font-size: 0.78rem; opacity: 0.5; padding: 8px 10px; text-align: center; }
.hist-unfiled-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.55; margin: 12px 4px 4px; }

.hist-folder-select {
    background: var(--bot-message-bg, rgba(127,127,127,0.1));
    color: var(--primary-text-color);
    border: 1px solid var(--border-color); border-radius: 6px;
    font-size: 0.72rem; padding: 2px 4px; max-width: 96px; cursor: pointer;
    font-family: inherit;
}
.hist-folder-select:hover { border-color: var(--neutral-line); }


/* ==== Configurações avançadas (versão LLM) ==== */
.cfg-section { padding: 14px 0; border-top: 1px solid var(--border-color); }
.cfg-section:first-child { border-top: none; padding-top: 4px; }
.cfg-h { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.6; margin: 0 0 12px; font-weight: 700; }
.cfg-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.cfg-field:last-child { margin-bottom: 0; }
.cfg-lbl { font-size: 0.9rem; font-weight: 500; }

.cfg-seg { display: inline-flex; background: rgba(127,127,127,0.1); border: 1px solid var(--border-color); border-radius: 9px; padding: 3px; gap: 3px; }
.cfg-seg-col { display: flex; flex-direction: column; width: 100%; }
.cfg-seg-btn {
    background: transparent; border: none; color: var(--secondary-text-color);
    padding: 7px 12px; border-radius: 7px; cursor: pointer; font-family: inherit;
    font-size: 0.82rem; font-weight: 600; transition: background 0.18s, color 0.18s; text-align: center;
}
.cfg-seg-col .cfg-seg-btn { text-align: left; }
.cfg-seg-btn:hover { color: var(--primary-text-color); }
.cfg-seg-btn.active { background: var(--neutral-fill); color: var(--neutral-on); }

/* Opcoes "ricas" (titulo + descricao), usadas no painel Modelos */
.cfg-seg-rich { display: flex; flex-direction: column; gap: 3px; padding: 11px 13px; margin-bottom: 6px;
    border: 1px solid var(--border-color, rgba(127,127,127,0.18)); border-radius: 10px; }
.cfg-seg-rich .cfg-seg-t { font-size: 0.9rem; font-weight: 700; }
.cfg-seg-rich .cfg-seg-d { font-size: 0.78rem; font-weight: 500; opacity: 0.72; line-height: 1.4; white-space: normal; }
.cfg-seg-rich.active { background: var(--neutral-fill); color: var(--neutral-on); border-color: transparent; }
.cfg-seg-rich.active .cfg-seg-d { opacity: 0.85; }
.cfg-hint-warn { color: #b58900; opacity: 0.95; }
.light-theme .cfg-hint-warn { color: #9a6a00; }

/* Aviso com icone de informacao (i em circulo), alinhado e sobrio */
.cfg-warn { display: flex; align-items: flex-start; gap: 9px; margin: 4px 2px 6px; }
.cfg-warn-ic { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px;
    fill: var(--secondary-text-color); opacity: 0.65; }
.cfg-warn-txt { margin: 0; font-size: 0.8rem; line-height: 1.5; text-align: left;
    color: var(--secondary-text-color); opacity: 0.9; }

.cfg-memory-body { margin-top: 12px; }
.cfg-memory-status { font-size: 0.82rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.mem-badge { font-size: 0.72rem; font-weight: 700; padding: 2px 10px; border-radius: 10px; }
.mem-badge.ready { background: rgba(34,197,94,0.18); color: #16a34a; }
.mem-badge.collecting { background: rgba(234,179,8,0.18); color: #b58900; }

.cfg-textarea, .cfg-input {
    width: 100%; box-sizing: border-box; background: var(--bot-message-bg, rgba(127,127,127,0.08));
    color: var(--primary-text-color); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 10px 12px; font-family: inherit; font-size: 0.9rem;
    resize: vertical; outline: none; transition: border-color 0.2s;
}
.cfg-textarea:focus, .cfg-input:focus { border-color: var(--neutral-line); }
.cfg-input { margin-bottom: 10px; }
.cfg-memory-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.cfg-btn {
    background: var(--neutral-fill); color: var(--neutral-on); border: none; border-radius: 8px;
    padding: 9px 16px; cursor: pointer; font-family: inherit; font-size: 0.85rem; font-weight: 600;
    transition: filter 0.2s;
}
.cfg-btn:hover { filter: brightness(1.12); }
.cfg-btn-ghost {
    background: transparent; color: var(--primary-text-color); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 9px 16px; cursor: pointer; font-family: inherit; font-size: 0.85rem; font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
}
.cfg-btn-ghost:hover { background: var(--component-hover-bg); border-color: var(--neutral-line); }
.cfg-btn-ghost:disabled { opacity: 0.5; cursor: default; }
.cfg-acc-msg { font-size: 0.82rem; margin: 4px 0 10px; min-height: 1em; font-family: 'Poppins', sans-serif; }
.cfg-acc-msg.err { color: #d93025; }
.cfg-acc-msg.ok { color: #16a34a; }


/* Mostrar/ocultar senha */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 42px !important; width: 100%; box-sizing: border-box; }
.pw-eye {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; cursor: pointer; padding: 6px;
    color: var(--secondary-text-color); display: flex; align-items: center; justify-content: center;
    border-radius: 6px; transition: color 0.15s, background 0.15s;
}
.pw-eye:hover { color: var(--primary-text-color); background: var(--component-hover-bg); }
/* no login (.name-input) o wrapper precisa manter o espacamento do input */
.login-form-panel .pw-wrap { margin-bottom: 0; }


/* ==== Modal + Configurações responsivos ==== */
.modal-box { max-height: 88vh; display: flex; flex-direction: column; }
.modal-box .modal-content { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #7d8590 transparent; }
.modal-box .modal-content::-webkit-scrollbar { width: 8px; }
.modal-box .modal-content::-webkit-scrollbar-thumb { background: #7d8590; border-radius: 8px; }
.modal-box .modal-content::-webkit-scrollbar-thumb:hover { background: #9aa4af; }
.modal-box .modal-content::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 640px) {
    .modal-overlay { align-items: center; }
    .modal-box {
        width: 92%; max-width: 92%; padding: 18px 16px; max-height: 85vh;
        border-radius: 14px;
    }
    .modal-title { font-size: 0.95em; }
    .cfg-row { font-size: 0.9rem; padding: 15px 8px; }
    .cfg-field { flex-direction: column; align-items: stretch; gap: 6px; }
    .cfg-seg { width: 100%; }
    .cfg-seg .cfg-seg-btn { flex: 1; }
    .cfg-lbl { font-size: 0.85rem; }
    .hist-toolbar { flex-wrap: wrap; }
    .btn-new-folder { width: 100%; justify-content: center; }
}


/* ==== Configurações como HUB (menu -> subtelas com transição) ==== */
.modal-box-hub { width: 460px; }
.cfg-hub { position: relative; overflow: hidden; }
.cfg-panel { display: none; }
.cfg-panel.active { display: block; }
.cfg-panel.active.from-right { animation: cfgInRight 0.30s cubic-bezier(0.22, 1, 0.36, 1); }
.cfg-panel.active.from-left  { animation: cfgInLeft 0.30s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes cfgInRight { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes cfgInLeft  { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

.cfg-row {
    width: 100%; display: flex; align-items: center; gap: 12px;
    background: transparent; border: none; border-radius: 10px;
    padding: 14px 12px; cursor: pointer; color: var(--primary-text-color);
    font-family: inherit; font-size: 0.95rem; font-weight: 500; text-align: left;
    transition: background 0.15s; position: relative;
}
.cfg-row:hover { background: var(--component-hover-bg); }
.cfg-row-static, .cfg-row-static:hover { cursor: default; background: transparent; }
#cfg-panel-main .cfg-row:not(:last-child)::after {
    content: ''; position: absolute; left: 44px; right: 10px; bottom: 0;
    height: 1px; background: var(--border-color); opacity: 0.4; pointer-events: none;
}
.cfg-ic { flex-shrink: 0; color: var(--secondary-text-color); opacity: 0.8; }
.cfg-row-label { flex: 1; }
.cfg-row-val { color: var(--secondary-text-color); opacity: 0.7; font-size: 0.85rem; margin-right: 4px; }
.cfg-chev { color: var(--secondary-text-color); opacity: 0.5; flex-shrink: 0; }
.cfg-row-switch { margin-left: auto; }

.cfg-back-btn { background: transparent; border: none; color: var(--primary-text-color); cursor: pointer; display: flex; align-items: center; padding: 0 4px 0 0; }
.cfg-back-btn:hover { opacity: 0.7; }

.cfg-hint { font-size: 0.83rem; color: var(--secondary-text-color); opacity: 0.85; margin: 0 0 14px; line-height: 1.45; }
.cfg-view-field { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--border-color); }
.cfg-view-lbl { color: var(--secondary-text-color); opacity: 0.7; font-size: 0.85rem; flex-shrink: 0; }
.cfg-view-val { font-weight: 500; text-align: right; word-break: break-all; }
.cfg-btn-full { width: 100%; margin-top: 16px; padding: 12px; }

@media (max-width: 640px) {
    .modal-box-hub { width: 100%; max-width: 100%; }
}

/* Toggles (liga/desliga) nao sao cortados: o texto quebra, o botao fica intacto */
.config-row > div { flex: 1; min-width: 0; }
.cfg-row-static .cfg-row-label { min-width: 0; overflow-wrap: anywhere; }
/* Contador de caracteres da memoria */
.cfg-char-count { text-align: right; font-size: 0.75rem; color: var(--secondary-text-color); opacity: 0.6; margin-top: 4px; }

/* A seta de avancar so aparece/funciona depois que a intro carrega (efeito + anel) */
#intro-next { opacity: 0; pointer-events: none; transition: opacity 0.4s ease, border-color 0.3s, background-color 0.3s; }
#intro-next.ready { opacity: 1; pointer-events: auto; }

/* Corrige corte na borda direita dos modais: tudo respeita a largura (padding para dentro) */
.modal-box, .modal-box *, .admin-card, .admin-card * { box-sizing: border-box; }


/* ===== Formatação de mensagens estilo ChatGPT (chat + histórico do admin) ===== */
.message-bubble p, .am-text p { margin: 0 0 0.75em; }
.message-bubble > *:first-child, .am-text > *:first-child { margin-top: 0; }
.message-bubble > *:last-child, .am-text > *:last-child { margin-bottom: 0; }
.message-bubble h1, .am-text h1, .message-bubble h2, .am-text h2,
.message-bubble h3, .am-text h3, .message-bubble h4, .am-text h4 { margin: 1.1em 0 0.5em; line-height: 1.3; font-weight: 700; }
.message-bubble h1, .am-text h1 { font-size: 1.3em; }
.message-bubble h2, .am-text h2 { font-size: 1.18em; }
.message-bubble h3, .am-text h3 { font-size: 1.05em; }
.message-bubble h4, .am-text h4 { font-size: 1em; }
.message-bubble ul, .am-text ul, .message-bubble ol, .am-text ol { margin: 0.5em 0 0.75em; padding-left: 1.5em; }
.message-bubble li, .am-text li { margin: 0.3em 0; line-height: 1.55; }
.message-bubble li > ul, .message-bubble li > ol, .am-text li > ul, .am-text li > ol { margin: 0.3em 0; }
.message-bubble strong, .am-text strong, .message-bubble b, .am-text b { font-weight: 700; }
.message-bubble a, .am-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.message-bubble hr, .am-text hr { border: none; border-top: 1px solid var(--border-color); margin: 1em 0; }
/* markdown no histórico do admin espelha o chat */
.am-text em { font-style: italic; opacity: 0.96; }
.am-text blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--border-color); opacity: 0.9; font-style: italic; }
.am-text table { border-collapse: separate; margin: 12px 0; width: 100%; font-size: 0.9em; display: block; overflow-x: auto; border: 1px solid var(--border-color); border-radius: 10px; border-spacing: 0; }
.am-text th, .am-text td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--border-color); border-right: 1px solid var(--border-color); }
.am-text tr td:last-child, .am-text tr th:last-child { border-right: none; }
.am-text thead th { font-weight: 700; border-bottom: 2px solid var(--border-color); text-transform: uppercase; font-size: 0.82em; }
.message-bubble pre, .am-text pre { background: var(--bot-message-bg, rgba(127,127,127,0.1)); border: 1px solid var(--border-color); border-radius: 10px; padding: 12px 14px; margin: 12px 0; overflow-x: auto; font-family: ui-monospace, 'Courier New', monospace; font-size: 0.86em; line-height: 1.5; }
.message-bubble pre code, .am-text pre code { background: none; padding: 0; border-radius: 0; font-size: 1em; white-space: pre; }
.am-text code { background: rgba(127,127,127,0.15); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, 'Courier New', monospace; font-size: 0.9em; }


/* ===== Conversa centralizada + sugestões de partida (estilo ChatGPT) ===== */
/* Modal de instruções com tamanho fixo + rolagem (não "pula" entre os passos) */


/* ===== Sidebar: histórico fixo + rodapé de identidade (estilo ChatGPT) ===== */
.side-panel-top { padding: 12px 10px 8px; border-bottom: 1px solid rgba(127,127,127,0.12); flex-shrink: 0; }
.sp-newchat { width: 100%; /* largura total: alinha com a linha de busca+pasta e com a lista abaixo */ box-sizing: border-box; display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid var(--border-color); color: var(--primary-text-color); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-family: inherit; font-size: 0.92rem; font-weight: 500; transition: background .15s, border-color .15s; }
.sp-newchat:hover { background: var(--component-hover-bg); border-color: var(--neutral-line); }
.sp-newchat svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.sp-tools { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.sp-tools .history-search { flex: 1; min-width: 0; margin: 0; }
.sp-folder-btn { flex-shrink: 0; width: 40px; height: 40px; justify-content: center; padding: 0; }
.side-panel-history { flex: 1 1 auto; overflow-y: auto; padding: 8px 10px; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(125,133,144,0.35) transparent; }
.side-panel-history::-webkit-scrollbar { width: 6px; }
.side-panel-history::-webkit-scrollbar-thumb { background: rgba(125,133,144,0.35); border-radius: 8px; }
.side-panel-history::-webkit-scrollbar-thumb:hover { background: #9aa4af; }
.side-panel-history::-webkit-scrollbar-track { background: transparent; }
.side-panel-footer { flex-shrink: 0; padding: 8px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid rgba(127,127,127,0.12); }
.sp-footer-links { display: none; flex-direction: column; gap: 2px; padding-bottom: 6px; margin-bottom: 2px; border-bottom: 1px solid rgba(127,127,127,0.12); }
.side-panel-footer.open .sp-footer-links { display: flex; }
.sp-user-row { display: flex; align-items: center; gap: 4px; }
.sp-user-toggle { flex-shrink: 0; width: 36px; height: 36px; background: transparent; border: none; color: var(--secondary-text-color); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 8px; transition: background .15s, color .15s; }
.sp-user-toggle:hover { background: var(--component-hover-bg); color: var(--primary-text-color); }
.sp-chevron { width: 18px; height: 18px; fill: currentColor; transition: transform .2s; }
.side-panel-footer.open .sp-chevron { transform: rotate(180deg); }
.sp-link { display: flex; align-items: center; gap: 12px; width: 100%; background: transparent; border: none; color: var(--secondary-text-color); cursor: pointer; padding: 9px 10px; border-radius: 8px; font-family: inherit; font-size: 0.88rem; text-align: left; transition: background .15s, color .15s; }
.sp-link:hover { background: var(--component-hover-bg); color: var(--primary-text-color); }
.sp-link svg { width: 19px; height: 19px; fill: currentColor; flex-shrink: 0; }
.sp-user { flex: 1; display: flex; align-items: center; gap: 10px; background: transparent; border: none; color: var(--primary-text-color); cursor: pointer; padding: 9px 10px; border-radius: 10px; font-family: inherit; text-align: left; min-width: 0; transition: background .15s; }
.sp-user:hover { background: var(--component-hover-bg); }
.sp-user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--neutral-fill); color: var(--neutral-on); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.sp-user-name { flex: 1; min-width: 0; font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.sp-avatar-btn { flex-shrink: 0; background: transparent; border: none; cursor: pointer; padding: 4px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.sp-avatar-btn:hover { background: var(--component-hover-bg); }
.sp-footer-actions { display: flex; gap: 2px; flex-shrink: 0; }
.sp-icon { background: transparent; border: none; color: var(--secondary-text-color); cursor: pointer; width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.sp-icon:hover { background: var(--component-hover-bg); color: var(--primary-text-color); }
.sp-icon svg { width: 20px; height: 20px; fill: currentColor; }

/* Modal "mover para pasta" */
.mv-folder-list { display: flex; flex-direction: column; gap: 6px; }
.mv-folder-opt { width: 100%; text-align: left; background: transparent; border: 1px solid var(--border-color); color: var(--primary-text-color); border-radius: 10px; padding: 12px 14px; cursor: pointer; font-family: inherit; font-size: 0.9rem; transition: background .15s, border-color .15s; }
.mv-folder-opt:hover { background: var(--component-hover-bg); border-color: var(--neutral-line); }
.mv-folder-empty { font-size: 0.82rem; opacity: 0.6; text-align: center; padding: 10px; }

/* Botões da telinha de confirmação */
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.cfg-btn-danger { background: #b3261e; color: #fff; border: none; }
.cfg-btn-danger:hover { filter: brightness(1.1); }

/* Botao "Iniciar interacao": sem retangulo de foco/toque (sem retangulo de toque) */
#start-button, #start-button:focus, #start-button:focus-visible, #start-button:active { outline: none; -webkit-tap-highlight-color: transparent; }

/* Selos acima das respostas no painel admin (RAG / estilo) */
.am-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.am-tag { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; background: rgba(127,127,127,0.15); color: var(--secondary-text-color); border: 1px solid var(--border-color); }
.am-tag-on { background: rgba(34,197,94,0.16); color: #22c55e; border-color: rgba(34,197,94,0.35); }
.am-tag-model { background: rgba(37,99,235,0.16); color: #3b82f6; border-color: rgba(37,99,235,0.35); font-weight: 600; }

/* Em telas de toque (celular) as acoes de conversa e pasta ficam sempre visiveis (acoes sempre visiveis) */
@media (hover: none) {
    .history-actions { opacity: 1; }
    .hist-folder-actions { opacity: 1; }
}

/* Admin: badge conta/visitante + item de exclusao de conversa */
.adm-tipo { font-size: 0.62rem; padding: 1px 7px; border-radius: 8px; margin-left: 6px; vertical-align: middle; }
.adm-tipo-conta { background: rgba(34,197,94,0.18); color: #22c55e; }
.adm-tipo-visitante { background: rgba(125,133,144,0.2); color: var(--secondary-text-color); }
.adm-del-item { display: flex; align-items: center; gap: 10px; }
.adm-del-info { flex: 1; min-width: 0; }
.adm-del-btn { flex-shrink: 0; background: transparent; border: 1px solid rgba(255,68,68,0.4); color: #ff6b6b; border-radius: 8px; width: 40px; height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.adm-del-btn:hover { background: rgba(255,68,68,0.12); }
.adm-del-btn svg { width: 18px; height: 18px; fill: currentColor; }



/* Telinha do visitante: opcao de criar conta */
.cfg-create-account { margin-top: 16px; border: 1px solid var(--border-color); border-radius: 10px; width: 100%; }
.cfg-create-account .cfg-ic { color: var(--led-static-blue); }
.cfg-create-account:hover { background: var(--component-hover-bg); }

/* ==== Modo paisagem / telas baixas (rotacao no celular/tablet) ==== */
@media (orientation: landscape) and (max-height: 520px) {
    /* modais voltam a ser centralizados e rolaveis (nao bottom-sheet) */
    .modal-overlay { align-items: center; }
    .modal-box {
        width: min(620px, 94%); max-width: 94%; max-height: 92vh;
        border-radius: 14px; border: 1px solid var(--border-color);
        padding: 14px 18px 18px;
    }
    .modal-box-hub { width: min(620px, 94%); }
    .modal-box .modal-content { max-height: 74vh; overflow-y: auto; }
    /* cabecalho um pouco mais baixo para sobrar area de conversa */
    .chat-header { height: 52px; min-height: 52px; }
    /* tela de login rola se nao couber */
    #view-auth { overflow-y: auto; }
    #view-auth .login-card { height: auto; min-height: 100%; }
    /* marca da abertura nao estoura a largura */
    .brand-svg { max-width: 62vw; }
    /* saudacao inicial: campo colado embaixo continua valendo */
    .cyborg-chat-container.landing .chat-history { flex: 0 0 auto; }

    /* telas centralizadas: fluem do topo e rolam se nao couber (evita corte em paisagem) */
    #view-welcome, #view-auth { justify-content: flex-start; overflow-y: auto; padding-top: 18px; padding-bottom: 18px; }

    /* tela de boas-vindas: compacta para caber na altura reduzida */
    .welcome-wrap { gap: 9px; max-width: 520px; }
    .welcome-ring { width: 56px; height: 56px; margin-bottom: 0; }
    .welcome-brand { font-size: 1.35em; letter-spacing: 4px; }
    .welcome-heading { font-size: 0.98rem; margin-top: 4px; }
    .welcome-sub { font-size: 0.88rem; }
    .welcome-advance { margin-top: 8px; padding: 11px 26px; font-size: 0.92rem; }

    /* splash: anel/nome nao estouram a altura */
    #view-intro .led-ring, .intro-orb-anchor { width: 64px; height: 64px; }

    /* rodape da boas-vindas: flui junto (rolavel), nao fixo na base */
    .welcome-footer { position: static; bottom: auto; margin-top: 14px; }
}

/* 3 pontinhos pulando (indicador de carregamento na bolha) */
.typing-dots { display: inline-flex; gap: 5px; align-items: center; padding: 2px 0; }
.typing-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--secondary-text-color); opacity: 0.5;
    animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
    30%           { transform: translateY(-5px); opacity: 1;   }
}

/* ==== Tela de boas-vindas (nova, separada do login) ==== */
#view-welcome { background: var(--bg-color); }
.welcome-wrap {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    max-width: 430px; padding: 0 26px; text-align: center;
}
.welcome-ring { width: 82px; height: 82px; margin-bottom: 4px; }
.welcome-brand {
    font-family: 'Times New Roman', Times, serif; letter-spacing: 5px;
    font-size: 1.7em; margin: 0; color: var(--primary-text-color);
}
.welcome-heading {
    font-family: 'Share Tech Mono', monospace; font-size: 1.12rem; letter-spacing: 0.5px;
    color: var(--primary-text-color); margin: 8px 0 0; font-weight: 700;
}
.welcome-sub {
    color: var(--secondary-text-color); opacity: 0.85; font-size: 0.95rem;
    line-height: 1.55; margin: 0;
}
.welcome-advance {
    margin-top: 16px; display: inline-flex; align-items: center; gap: 10px;
    background: var(--primary-text-color); color: var(--bg-color);
    border: none; border-radius: 30px; padding: 14px 30px; cursor: pointer;
    font-family: 'Share Tech Mono', monospace; font-weight: 700; letter-spacing: 1px;
    font-size: 1rem; transition: filter 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 18px rgba(0,0,0,0.35);
}
.welcome-advance:hover { filter: brightness(1.1); transform: translateY(-1px); }
.welcome-advance svg { width: 20px; height: 20px; fill: currentColor; }
.welcome-footer {
    position: absolute; bottom: 22px; left: 0; right: 0;
    text-align: center; padding: 0 28px; margin: 0;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.72rem, 2.6vw, 0.85rem);
    color: var(--secondary-text-color); opacity: 0.55; line-height: 1.4;
}

/* Seta de voltar no login (so quando veio de 'Criar conta') */
.auth-back-ctrl { position: absolute; top: 16px; left: 16px; z-index: 30; }

/* ==== Autores (carrossel) ==== */
.autor-card { display: none; text-align: center; padding: 4px 2px 2px; }
.autor-card.active { display: block; }
.autor-card.active.from-right { animation: slideFromRight 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
.autor-card.active.from-left  { animation: slideFromLeft 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
.autor-foto {
    width: 112px; height: 112px; border-radius: 50%; margin: 0 auto 14px;
    position: relative; overflow: hidden; flex-shrink: 0;
    background: var(--user-message-bg);
    border: 2px solid var(--led-static-blue);
    display: flex; align-items: center; justify-content: center;
}
.autor-foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.autor-inicial { font-family: 'Share Tech Mono', monospace; font-size: 1.9rem; font-weight: 700; color: var(--secondary-text-color); }
.autor-nome { font-size: 1.02rem; font-weight: 700; margin: 0 0 3px; color: var(--primary-text-color); line-height: 1.3; }
.autor-titulo { font-size: 0.82rem; color: var(--led-static-blue); font-weight: 700; margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.autor-papel { font-size: 0.88rem; color: var(--secondary-text-color); opacity: 0.9; line-height: 1.5; margin: 0 0 12px; }
.autor-email { font-size: 0.82rem; color: var(--led-static-blue); text-decoration: none; word-break: break-all; }
.autor-email:hover { text-decoration: underline; }
.autor-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.autor-arrow {
    width: 34px; height: 34px; border-radius: 50%; background: transparent;
    border: 1px solid var(--border-color); color: var(--secondary-text-color);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
}
.autor-arrow svg { width: 18px; height: 18px; }
.autor-arrow:hover { background: var(--component-hover-bg); color: var(--primary-text-color); border-color: var(--led-static-blue); }
.autor-dots { display: flex; gap: 7px; align-items: center; }
.autor-dot { width: 8px; height: 8px; border-radius: 50%; border: none; padding: 0; cursor: pointer; background: var(--border-color); transition: background .2s, transform .2s; }
.autor-dot.active { background: var(--led-static-blue); transform: scale(1.25); }

/* ==== Sobre o Cyborg AI ==== */
.sobre-texto { font-size: 0.9rem; line-height: 1.6; color: var(--secondary-text-color); margin: 0 0 12px; text-align: justify; }
.sobre-meta { border-top: 1px solid var(--border-color); margin-top: 14px; padding-top: 10px; }
.sobre-linha { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 5px 2px; color: var(--secondary-text-color); }
.sobre-linha span:last-child { font-weight: 700; color: var(--primary-text-color); }
.sobre-copy { font-size: 0.76rem; color: var(--secondary-text-color); opacity: 0.65; line-height: 1.5; margin: 12px 0 0; text-align: center; }

/* Botao "Sair" dentro de Sua conta (menos destacado que as acoes principais) */
.cfg-btn-sair {
    width: 100%; margin-top: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: transparent; color: var(--secondary-text-color);
    border: 1px solid var(--border-color); border-radius: 8px;
    padding: 11px 16px; cursor: pointer; font-family: inherit; font-size: 0.88rem; font-weight: 600;
    transition: background 0.18s, border-color 0.18s;
}
.cfg-btn-sair:hover { background: var(--component-hover-bg); border-color: var(--neutral-line, var(--border-color)); color: var(--primary-text-color); }
.cfg-btn-sair svg { fill: currentColor; flex-shrink: 0; }

/* "Excluir minha conta": botao discreto em vermelho, dentro de "Sua conta" */
.cfg-btn-excluir {
    width: 100%; margin-top: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: transparent; color: #d93025;
    border: 1px solid transparent; border-radius: 8px;
    padding: 10px 16px; cursor: pointer; font-family: inherit; font-size: 0.85rem; font-weight: 600;
    transition: background 0.18s;
}
.cfg-btn-excluir:hover { background: rgba(217,48,37,0.10); }
.cfg-btn-excluir svg { fill: currentColor; flex-shrink: 0; }

/* Botao de confirmacao da exclusao (vermelho preenchido) */
.cfg-btn-danger { background: #d93025; color: #fff; border: none; }
.cfg-btn-danger:hover { background: #b3261e; }

/* Aviso de perigo (vermelho) reaproveitando o layout do .cfg-warn */
.cfg-warn-danger .cfg-warn-ic { fill: #d93025; opacity: 0.9; }
.cfg-warn-danger .cfg-warn-txt { color: #d93025; opacity: 0.95; }
.light-theme .cfg-warn-danger .cfg-warn-txt { color: #b3261e; }

/* Icone do "Fechar aplicativo" em vermelho (apenas o icone) */
#sp-link-exit svg { fill: #d93025; }

/* ==== Acoes sob cada mensagem (copiar / data e hora) ==== */
.msg-actions { display: flex; align-items: center; gap: 1px; margin-top: 2px; opacity: 0.22; transition: opacity 0.2s ease; }
.message-container:hover .msg-actions { opacity: 0.7; }
.user-container .msg-actions { justify-content: flex-end; }
.msg-act {
    background: transparent; border: none; padding: 3px; cursor: pointer;
    color: var(--secondary-text-color); display: inline-flex; align-items: center;
    border-radius: 6px; transition: background 0.15s, color 0.15s;
}
.msg-act svg { width: 13px; height: 13px; fill: currentColor; }
.msg-act:hover { background: var(--component-hover-bg); color: var(--primary-text-color); }
.msg-act.ok { color: #16a34a; }
    /* carimbo de data/hora */
.msg-stamp {
    font-size: 0.68rem; color: var(--secondary-text-color);
    opacity: 0; max-width: 0; overflow: hidden; white-space: nowrap;
    transition: opacity 0.2s ease, max-width 0.28s ease, margin 0.2s ease;
}
.msg-stamp.show { opacity: 0.55; max-width: 220px; margin-left: 5px; }

/* ============================================================================== */
/*  MOLDURAS NEUTRAS (v104) — visual discreto em cinza, sem cores de destaque.     */
/*  Bordas finas neutras + cantos chanfrados. Microfone neutro com morph/pulso.    */
/* ============================================================================== */

/* Icone de expandir (chevron) um pouco maior e destacado — NEUTRO */
.sp-user-toggle {
    width: 42px; height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--secondary-text-color);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.sp-user-toggle:hover { background: var(--component-hover-bg); color: var(--primary-text-color); }
.sp-chevron { width: 22px; height: 22px; }

/* Linha da conta com moldura geometrica NEUTRA (cantos chanfrados) */
.sp-user-row {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 5px 6px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

/* Menu do rodape (aberto): painel com moldura NEUTRA e cantos chanfrados */
.side-panel-footer.open .sp-footer-links {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 8px 12px;
    margin-bottom: 8px;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
    animation: cyberPanelIn .28s ease;
}
@keyframes cyberPanelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 'Fechar aplicativo' em cor NEUTRA (sem vermelho) */
#sp-link-exit svg { fill: currentColor; }

/* Microfone: cor NEUTRA + morph (mic -> quadrado) + pulso neutro */
#mic-button .ico-mic,
#mic-button .ico-mic-stop {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    transition: opacity .25s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
#mic-button .ico-mic { opacity: 1; transform: scale(1) rotate(0deg); }
#mic-button .ico-mic-stop { opacity: 0; transform: scale(.3) rotate(-60deg); }
#mic-button.is-listening .ico-mic { display: flex; opacity: 0; transform: scale(.3) rotate(60deg); }
#mic-button.is-listening .ico-mic-stop { display: flex; opacity: 1; transform: scale(1) rotate(0deg); }
#mic-button.is-listening {
    color: var(--neutral-on);
    background: var(--component-hover-bg);
    animation: micPulseNeutral 1.5s ease-out infinite;
}
@keyframes micPulseNeutral {
    0%   { box-shadow: 0 0 0 0 rgba(125,133,144,0.45); }
    70%  { box-shadow: 0 0 0 11px rgba(125,133,144,0); }
    100% { box-shadow: 0 0 0 0 rgba(125,133,144,0); }
}
.input-pill.is-recording .voice-wave i { background: var(--neutral-line); }

/* ============================================================================== */
/*  TELA DE IDENTIFICACAO — formas geometricas NEUTRAS (v105)                      */
/*  Cantos chanfrados + colchetes discretos em cinza (sem cores de destaque).      */
/* ============================================================================== */

/* moldura HUD neutra ao redor do formulario */
#setup-container { position: relative; }
#setup-container::before,
#setup-container::after {
    content: ''; position: absolute; width: 18px; height: 18px; pointer-events: none;
    border: 2px solid var(--secondary-text-dark); opacity: 0.45;
}
#setup-container::before { top: -12px; left: -8px; border-right: none; border-bottom: none; }
#setup-container::after { bottom: -14px; right: -8px; border-left: none; border-top: none; }

/* alternador visitante x conta: cantos chanfrados */
.auth-tabs {
    border-radius: 0;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.auth-tab.active {
    border-radius: 0;
    box-shadow: none;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

/* campos de texto: cantos chanfrados (top-right / bottom-left) */
.name-input {
    border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.name-input:focus { box-shadow: inset 0 0 0 1px var(--neutral-line); }

/* botao ENTRAR: forma geometrica com cantos cortados + brilho neutro */
.btn-start-research {
    border-radius: 0;
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
    letter-spacing: 2px;
}
.btn-start-research:hover { filter: brightness(1.15); box-shadow: 0 0 22px rgba(125, 133, 144, 0.32); }

/* ============================================================================== */
/*  SUBTELAS geometricas NEUTRAS (v106)                                            */
/*  Remove colchetes do formulario de identificacao e aplica cantos chanfrados     */
/*  (fechados, sem borda) nos controles das subtelas de Configuracoes.             */
/* ============================================================================== */

/* remove os colchetes do canto do formulario de identificacao */
#setup-container::before,
#setup-container::after { content: none; display: none; }

/* segmentos (Tema / Idioma / Estilo): sem a "pill" com borda; chips chanfrados */
.cfg-seg { background: transparent; border: none; border-radius: 0; padding: 0; gap: 8px; }
.cfg-seg-btn {
    border: none;
    border-radius: 0;
    background: rgba(127,127,127,0.10);
    padding: 9px 14px;
    clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}
.cfg-seg-btn.active { background: var(--neutral-fill); color: var(--neutral-on); }

/* opcoes "ricas" (painel Modelos): mesmo chanfro, sem borda */
.cfg-seg-rich {
    border: none; border-radius: 0; background: rgba(127,127,127,0.08);
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.cfg-seg-rich.active { background: var(--neutral-fill); }

/* campos de texto: chanfro (top-right / bottom-left), sem borda */
.cfg-textarea, .cfg-input {
    border: none; border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
}
.cfg-textarea:focus, .cfg-input:focus { box-shadow: inset 0 0 0 1.5px var(--neutral-line); }

/* botoes das subtelas: chanfro fechado */
.cfg-btn, .cfg-btn-ghost, .cfg-btn-sair, .cfg-btn-excluir, .lang-option, .mv-folder-opt {
    border-radius: 0;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
/* trocar bordas por preenchimento sutil (arestas fechadas, sem borda cortada) */
.cfg-btn-ghost, .cfg-btn-sair, .lang-option, .mv-folder-opt {
    border: none; background: rgba(127,127,127,0.10);
}
.cfg-btn-ghost:hover, .cfg-btn-sair:hover, .lang-option:hover, .mv-folder-opt:hover {
    background: var(--component-hover-bg);
}

/* Botao "Iniciar" (tela de boas-vindas): forma geometrica chanfrada (v107) */
.welcome-advance {
    border-radius: 0;
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
