@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Merriweather:ital,wght@0,700;1,400&display=swap');
:root {
    /* --- PALETA PREMIUM ORGANIC --- */
    /* Fondo: No blanco puro, sino un "papel" cálido y costoso */
    --bg-color: #FDFDFB;
    --bg-gradient: radial-gradient(circle at top left, #F4F9F7 0%, #FFF 40%);
    --bg-color-alt: #f4f4f2;

    /* Sidebar: Glassmorphism realzado */
    --sidebar-bg: rgba(255, 255, 255, 0.75);
    --sidebar-border: 1px solid rgba(255, 255, 255, 0.6);

    /* Texto */
    --primary-text-color: rgba(15, 23, 42, 0.92);
    --secondary-text-color: rgba(51, 65, 85, 0.88);
    --muted-text: #9CA3AF;
    --border-color: rgba(15, 76, 58, 0.08);

    /* Marca: Verde Bosque Profundo + Acento Menta */
    --brand-primary: #0F4C3A;
    --brand-secondary: #10B981;
    --brand-accent: #D1FAE5;

    /* Botones */
    --button-bg: #0F4C3A;
    --button-bg-strong: #0C3C2E;
    --button-text-color: #FFFFFF;

    /* Burbujas de Chat */
    /* Orbe emocional (resonancia biológica visual) */
    --orb-breath-duration: 4s;
    --orb-main-hue: 160;
    --orb-main-sat: 80%;
    --orb-main-light: 55%;

    --user-message-bg: linear-gradient(135deg, #0F4C3A 0%, #166550 100%);
    --user-text: #FFFFFF;
    --ai-message-bg: #FFFFFF;

    /* Sombras Elevadas (Soft Shadows) */
    --shadow-sm: 0 2px 8px rgba(15, 76, 58, 0.04);
    --shadow-md: 0 12px 24px -6px rgba(15, 76, 58, 0.08);
    --shadow-soft: 0 12px 40px -12px rgba(15, 76, 58, 0.12);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);

    /* Extras heredados */
    --glass: rgba(255, 255, 255, 0.75);
    --shadow-inner: inset 0 1px 0 rgba(255,255,255,0.75);
}

/* =============================
   Premium JSON Forms (FORM_JSON)
   ============================= */
.chat-form-shell {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  background: #ffffff;
  padding: 16px;
  margin: 14px 0;
  box-shadow: 0 8px 28px rgba(0,0,0,0.06);
}

.chat-form__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chat-form__title {
  font-family: Inter, "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: rgba(0,0,0,0.86);
  margin: 0;
}

.chat-form__description {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(0,0,0,0.62);
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-form__section {
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0,0,0,0.02);
}

.chat-form__section-title {
  font-weight: 700;
  font-size: 13px;
  color: rgba(0,0,0,0.74);
  margin: 0 0 10px 0;
}

.chat-form__field {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
}

.chat-form__field.is-wide {
  grid-column: 1 / -1;
}

.chat-form__label-row {
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-form__label {
  font-weight: 600;
  font-size: 13px;
  color: rgba(0,0,0,0.80);
}

.chat-form__required {
  font-size: 12px;
  color: rgba(210, 60, 60, 0.95);
}

.chat-form__field input[type="text"],
.chat-form__field input[type="email"],
.chat-form__field input[type="tel"],
.chat-form__field input[type="number"],
.chat-form__field input[type="date"],
.chat-form__field textarea,
.chat-form__field select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.10);
  background: #ffffff;
  outline: none;
  font-size: 13px;
  color: rgba(0,0,0,0.84);
}

.chat-form__field textarea {
  resize: vertical;
  min-height: 72px;
}

.chat-form__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.chat-form__option {
  display:flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: rgba(0,0,0,0.02);
  cursor: pointer;
  user-select: none;
}

.chat-form__option input {
  transform: scale(1.05);
}

.chat-form__static {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(0,0,0,0.68);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(0,0,0,0.14);
  background: rgba(0,0,0,0.02);
}

.chat-form__scale {
  display:flex;
  flex-direction: column;
  gap: 8px;
}

.chat-form__scale-meta {
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-form__scale-value {
  font-weight: 700;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.02);
  color: rgba(0,0,0,0.80);
}

.chat-form__repeatable {
  display:flex;
  flex-direction: column;
  gap: 10px;
}

.chat-form__repeatable-row {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  background: rgba(0,0,0,0.02);
}

.chat-form__repeatable-actions {
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-form__actions {
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.chat-form__btn {
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(0,0,0,0.02);
  color: rgba(0,0,0,0.82);
}

.chat-form__btn.is-primary {
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.90);
  color: #ffffff;
}

.chat-form__btn.is-secondary {
  background: rgba(0,0,0,0.04);
}

.chat-form__btn.is-ghost {
  background: transparent;
}

.chat-form__status {
  font-size: 12px;
  line-height: 1.4;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  background: rgba(0,0,0,0.02);
  color: rgba(0,0,0,0.72);
}

.chat-form__status.is-success {
  border-color: rgba(0, 128, 0, 0.25);
  background: rgba(0, 128, 0, 0.06);
}

.chat-form__status.is-error {
  border-color: rgba(210, 60, 60, 0.30);
  background: rgba(210, 60, 60, 0.06);
}

.chat-form__result {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  padding: 12px;
  background: #ffffff;
}

.chat-form__result-title {
  font-weight: 800;
  font-size: 13px;
  color: rgba(0,0,0,0.84);
  margin-bottom: 6px;
}

.chat-form__result-meta {
  font-size: 12px;
  color: rgba(0,0,0,0.60);
  margin-bottom: 10px;
}

.chat-form__result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.chat-form__result-row {
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.02);
}

.chat-form__result-k {
  font-size: 12px;
  font-weight: 700;
  color: rgba(0,0,0,0.76);
  margin-bottom: 6px;
}

.chat-form__result-v {
  font-size: 13px;
  color: rgba(0,0,0,0.84);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: 'Inter', 'Söhne', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--primary-text-color);
    -webkit-font-smoothing: antialiased;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

h1, h2, h3, .sidebar-title, .brand-title {
    letter-spacing: -0.02em;
    color: var(--primary-text-color);
}

/* Contenedor principal tipo ChatGPT */
.chat-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    background: linear-gradient(135deg, rgba(16, 163, 127, 0.05), rgba(10, 139, 111, 0.08));
    align-items: start;
}

.chat-container.sidebar-collapsed {
    grid-template-columns: 90px 1fr;
}

.chat-container .sidebar {
    grid-column: 1;
    grid-row: 1;
}

.chat-container .main-panel {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.32);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 80;
    opacity: 0;
    transition: opacity 0.25s ease;
}

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

/* ---------- SIDEBAR ---------- */

.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow: 20px 0 40px rgba(0,0,0,0.02);
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh; /* Siempre a pantalla completa */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(255, 255, 255, 0.4);
}

.sidebar.collapsed {
    width: 72px;
    padding: 1.25rem 0.6rem 1rem;
    transition: width 0.3s ease;
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-menu li a,
.sidebar.collapsed #new-chat-btn,
.sidebar.collapsed .user-profile,
.sidebar.collapsed .sidebar-bottom {
    justify-content: center;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-subtitle,
.sidebar.collapsed .brand-text,
.sidebar.collapsed .sidebar-menu span,
.sidebar.collapsed .user-profile .user-name,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .chat-session-text,
.sidebar.collapsed .sidebar-menu li a svg + span,
.sidebar.collapsed .sidebar-toggle-text,
.sidebar.collapsed .chat-session-delete,
.sidebar.collapsed .chat-session-preview {
    display: none;
}

.sidebar.collapsed .sidebar-menu li a,
.sidebar.collapsed #new-chat-btn {
    padding: 0.55rem 0.4rem;
    text-align: center;
}

.sidebar.collapsed .sidebar-header .logo {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-menu li a svg,
.sidebar.collapsed #new-chat-btn svg {
    margin-right: 0;
}

.sidebar.collapsed .brand-mark {
    padding: 0.5rem;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 0 0 auto;
}

.sidebar-bottom {
    flex: 1 1 auto;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    overflow-y: auto;
}

/* Ocultar el interruptor de genograma y su panel cuando no se desea mostrar */
.sidebar-genogram-toggle {
    display: none;
}

#genogram-panel {
    display: none;
}

.sidebar-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 1.85rem;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem; /* más alto y cómodo, ya no se aplasta */
    background: transparent;
    border-radius: 999px;
    box-shadow: none;
    border: none;
    flex: 1;
    min-width: 0;
    margin-top: 0.15rem;
    position: relative;
}

.brand-mark::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 10% 0%, rgba(255,255,255,0.55), transparent 55%);
    opacity: 0.9;
    pointer-events: none;
}

.brand-text {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    line-height: 1.1;
    white-space: nowrap;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 0.35rem;
    color: var(--secondary-text-color);
    padding: 0.35rem;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(45, 79, 72, 0.08);
}

.sidebar-header .logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(145deg, #1fb58a 0%, #0f7f63 50%, #0b5a46 100%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 14px 30px -12px rgba(0,0,0,0.35);
    position: relative;
    overflow: hidden;
}

/* Separación correcta entre el ícono y el texto “Health-IA Chat” */
.sidebar-header .logo {
    margin-right: 0.55rem;
}

.logo-stetho::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 13px;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.28), transparent 60%);
}

.logo-stetho {
    position: relative;
    overflow: hidden;
}

.sidebar-header .stetho-icon {
    width: 26px;
    height: 26px;
    position: relative;
    z-index: 1;
}

.brand-title {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #0F4C3A 0%, #10B981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.sidebar-menu {
    flex-grow: 1;
    margin-top: 1rem;
}

.sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li a,
#new-chat-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #4B5563;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: background-color 0.15s ease;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.sidebar-menu li a:hover,
#new-chat-btn:hover,
.sidebar-menu li a.active {
    background: var(--brand-accent);
    color: var(--brand-primary);
}

.sidebar-menu li a:active,
#new-chat-btn:active,
button:active {
    transform: scale(0.98);
}

.user-profile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    position: relative;
}

#login-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

#login-buttons button {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--glass);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

#login-buttons button:hover {
    background-color: #e5e7eb;
    border-color: var(--secondary-text-color);
}

#user-info {
    display: none;
    align-items: center;
    cursor: pointer;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    object-fit: cover;
    background: linear-gradient(135deg, #e0f4f0, #f5f9ff);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.sidebar-user-name {
    font-weight: 600;
    color: var(--primary-text-color);
    font-size: 0.95rem;
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 0.75rem;
    object-fit: cover;
}

.user-profile .user-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--primary-text-color);
}

.login-error {
    margin-top: 8px;
    font-size: 0.82rem;
    color: #b3261e;
}

/* Menú de logout */
#logout-menu {
    position: absolute;
    top: calc(100% + 0.65rem);
    right: 0;
    left: auto;
    background: #ffffff;
    border: 1px solid rgba(45, 79, 72, 0.1);
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
    display: none;
    box-shadow: 0 18px 38px -18px rgba(0,0,0,0.28);
    z-index: 30;
    min-width: 170px;
}

#logout-menu button {
    background: none;
    border: none;
    padding: 0.35rem 0;
    cursor: pointer;
    font-size: 0.95rem;
    width: 100%;
    text-align: left;
}

#logout-menu .logout-menu-item {
    color: #0f172a;
}

#logout-btn {
    color: #b91c1c;
}

.recent-chats {
    padding: 1rem 0.5rem 1rem 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.recent-chats h3 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: var(--muted-text);
}

.recent-chats-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.recent-chat-item {
    padding: 0.6rem 0.7rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.recent-chat-item:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.recent-chat-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #f8fafc;
}

.recent-chat-subtitle {
    font-size: 0.85rem;
    color: var(--muted-text);
    margin-top: 0.15rem;
}

.chat-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-bottom: 0.5rem;
}

.chat-session-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.55rem 0.7rem;
    border-radius: 14px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.chat-session-item:hover {
    background: rgba(255,255,255,0.6);
    border-color: rgba(255,255,255,0.8);
    box-shadow: 0 6px 14px rgba(0,0,0,0.04);
    transform: translateY(-1px);
}

.chat-session-text {
    flex: 1 1 auto;
    min-width: 0;
}

.chat-session-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chat-session-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    margin-bottom: 0.1rem;
}

.chat-session-preview {
    font-size: 0.78rem;
    color: var(--muted-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-session-star {
    border: none;
    background: transparent;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(240, 180, 60, 0.6);
    cursor: pointer;
    transition: transform 0.1s ease, background 0.15s ease, color 0.15s ease;
}

.chat-session-star.is-active {
    color: #fbbf24;
}

.chat-session-star:hover {
    background: rgba(251, 191, 36, 0.1);
    transform: translateY(-1px);
}

.chat-session-delete {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    color: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.chat-session-delete:hover {
    background: rgba(255,0,0,0.08);
    color: rgba(200,0,0,0.9);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 19, 16, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.2rem 1.2rem 1rem;
    width: min(420px, 94vw);
    box-shadow: 0 18px 50px rgba(0,0,0,0.12);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.modal-dialog h3 {
    margin: 0 0 0.2rem;
    color: var(--secondary-text-color);
    font-weight: 700;
}

.modal-dialog label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.modal-dialog input,
.modal-dialog select,
.modal-dialog textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 0.55rem 0.7rem;
    background: #f9fbfa;
    font-size: 0.92rem;
}

.modal-dialog textarea {
    resize: vertical;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: #ffffff;
    cursor: pointer;
    color: var(--muted-text);
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.modal-actions .spacer {
    flex: 1;
}

.modal-actions button {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.55rem 0.9rem;
    background: rgba(255,255,255,0.95);
    cursor: pointer;
}

.modal-actions button.primary {
    background: linear-gradient(120deg, #15c39a, #0ca47f);
    color: #fff;
    border: none;
}

.modal-actions button.ghost {
    background: rgba(15,178,141,0.08);
    color: var(--secondary-text-color);
}

.checkbox-row {
    flex-direction: row !important;
    align-items: center;
    gap: 0.45rem !important;
}

/* ---------- PANEL PRINCIPAL ---------- */

.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    padding: 1.25rem 1.5rem 1rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.chat-container.sidebar-collapsed .main-panel {
    max-width: calc(100vw - 140px);
}

.mobile-nav-toggle {
    display: none;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    margin: 0 0 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(15, 76, 58, 0.14);
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary-text-color);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.mobile-nav-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.mobile-nav-label {
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.main-content {
    display: block;
}

.chat-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding: 16px 24px 24px;
}

.chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100vh; /* columna central ocupa toda la altura, como ChatGPT */
}

.chat-header-minimal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 18px;
    background: linear-gradient(120deg, #eefaf6, #f4fbff);
    border: 1px solid rgba(0,0,0,0.03);
}

.chat-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-logo-badge {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: #0fb88f1a;
    color: #0a8a68;
}

/* --- ORBE DE CONCIENCIA (CORREGIDO) --- */
.consciousness-orb {
    width: 80px;
    height: 80px;
    position: relative;
    display: block;
    margin-left: 12px;
    flex-shrink: 0;
    z-index: 10;

    /* Orbe base: cápsula luminosa para el gatito médico */
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #e0f7f2 45%, #b3ece2 100%);
    border: 2px solid rgba(79, 209, 197, 0.32);
    box-shadow:
        0 0 18px rgba(79, 209, 197, 0.45),
        0 0 36px rgba(79, 209, 197, 0.25),
        inset 0 0 12px rgba(0, 0, 0, 0.16);

    animation: pulse 4s ease-in-out infinite;
    transition: all 0.5s ease;
}


.floating-orb {
    position: fixed;
    bottom: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    z-index: 30;
    filter: drop-shadow(0 8px 18px rgba(15, 184, 143, 0.18));
    animation: floatDrift 8s ease-in-out infinite;
}

.floating-orb .consciousness-orb {
    width: 80px;
    height: 80px;
    position: relative;
    display: block;
    margin-left: 12px;
    flex-shrink: 0;
    z-index: 10;

    /* Orbe base: cápsula luminosa para el gatito médico */
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #e0f7f2 45%, #b3ece2 100%);
    border: 2px solid rgba(79, 209, 197, 0.32);
    box-shadow:
        0 0 18px rgba(79, 209, 197, 0.45),
        0 0 36px rgba(79, 209, 197, 0.25),
        inset 0 0 12px rgba(0, 0, 0, 0.16);

    animation: pulse 4s ease-in-out infinite;
    transition: all 0.5s ease;
}

.floating-orb .consciousness-orb.is-dragging {
    cursor: grabbing;
    transform: scale(1.05);
    box-shadow: 0 12px 25px rgba(15, 184, 143, 0.35);
}


.floating-orb.orb-motion-sick .consciousness-orb {
    width: 80px;
    height: 80px;
    position: relative;
    display: block;
    margin-left: 12px;
    flex-shrink: 0;
    z-index: 10;

    /* Orbe base: cápsula luminosa para el gatito médico */
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #e0f7f2 45%, #b3ece2 100%);
    border: 2px solid rgba(79, 209, 197, 0.32);
    box-shadow:
        0 0 18px rgba(79, 209, 197, 0.45),
        0 0 36px rgba(79, 209, 197, 0.25),
        inset 0 0 12px rgba(0, 0, 0, 0.16);

    animation: pulse 4s ease-in-out infinite;
    transition: all 0.5s ease;
}

.floating-orb.orb-bounce {
    animation: orbBounce 0.6s cubic-bezier(0.21, 0.92, 0.29, 1.12);
}

.floating-orb.orb-fidget {
    animation: orbFidget 0.9s ease-in-out;
}

@keyframes orbBounce {
    0%   { transform: translateY(0); }
    30%  { transform: translateY(-10px); }
    55%  { transform: translateY(4px); }
    80%  { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}

@keyframes orbSway {
    0%   { transform: translateX(0); }
    50%  { transform: translateX(5px); }
    100% { transform: translateX(-4px); }
}

@keyframes orbFidget {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(2px, -3px); }
    50%  { transform: translate(-2px, 2px); }
    75%  { transform: translate(1px, -1px); }
    100% { transform: translate(0, 0); }
}

.floating-orb-whisper {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 184, 143, 0.15);
    box-shadow: 0 18px 30px rgba(15, 184, 143, 0.12);
    color: #0f172a;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.92rem;
    max-width: 220px;
    line-height: 1.4;
    backdrop-filter: blur(8px);
    pointer-events: none;
}

@media (max-width: 768px) {
    .floating-orb {
        bottom: 82px;
        right: 12px;
        transform: scale(0.9);
    }

    .floating-orb-whisper {
        display: none;
    }
}

.orb-core {
    position: absolute;
    inset: 8px;
    margin: auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #f4fffd 40%, #e0faf5 100%);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.95);
    z-index: 2;
    overflow: visible;
}

.orb-aura {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    opacity: 0.85; /* Más visible por defecto */
    filter: blur(5px);
    
    /* Animación base de respiración */
    animation: rotateAura 8s linear infinite;
    background: conic-gradient(from 0deg, #10B981, #3B82F6, #10B981);
}

@keyframes floatDrift {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

.consciousness-orb.orb-level-2 .orb-aura {
    background: conic-gradient(from 90deg, #22c55e, #06b6d4, #22c55e);
    opacity: 0.75;
}

.consciousness-orb.orb-level-3 .orb-aura {
    background: conic-gradient(from 180deg, #a855f7, #06b6d4, #22c55e, #a855f7);
    opacity: 0.82;
    animation-duration: 3.3s;
}

.consciousness-orb.orb-level-4 .orb-aura {
    background: conic-gradient(from 260deg, #f472b6, #a855f7, #22c55e, #06b6d4, #f472b6);
    opacity: 0.9;
    animation-duration: 2.6s;
}

.consciousness-orb.orb-level-5 .orb-aura {
    background: conic-gradient(
        from 260deg,
        #f472b6,
        #a855f7,
        #22c55e,
        #06b6d4,
        #fbbf24,
        #f472b6
    );
    opacity: 1;
    animation-duration: 2s;
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.6);
}

.consciousness-orb.is-processing .orb-aura {
    animation-duration: 2.1s;
    opacity: 1;
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
}

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

/* --- AJUSTE PARA MÓVILES --- */
/* Esto oculta el texto "Modo médico..." en pantallas pequeñas para dar espacio al orbe */
@media (max-width: 600px) {
    .chat-mode-pill {
        font-size: 0; /* Oculta texto */
        padding: 6px; /* Reduce tamaño */
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background-color: #10B981; /* Solo un puntito verde indicador */
    }
}

.chat-logo-badge.is-processing,
.logo-stetho.is-processing {
    animation: ai-breathing 2s infinite ease-in-out;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

@keyframes ai-breathing {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
    50% { transform: scale(1.05); box-shadow: 0 0 12px rgba(16, 185, 129, 0.3); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
}

.chat-header-minimal h1 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chat-header-minimal p {
    font-size: 0.82rem;
    margin: 0;
    color: #60717b;
}

.chat-mode-pill {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.05);
    color: #4d5b64;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 20px 40px -10px rgba(0,0,0,0.05),
        inset 0 0 0 1px rgba(255,255,255, 0.5);
    border-radius: 24px;
}

.chat-column {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.safety-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-left: 4px solid rgba(200, 70, 70, 0.28);
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    color: var(--primary-text-color);
}

.safety-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.safety-copy {
    font-size: 0.92rem;
    color: var(--muted-text);
}


.chat-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(120deg, rgba(45, 79, 72, 0.08), rgba(212, 249, 83, 0.06));
    border: 1px solid var(--border-color);
    border-radius: 18px;
}

.chat-hero h2 {
    margin: 0 0 0.35rem;
    font-size: 1.6rem;
}

.chat-hero .lede {
    margin: 0;
    color: var(--muted-text);
    max-width: 640px;
    line-height: 1.5;
}

.hero-highlights {
    margin: 0.6rem 0 0;
    padding-left: 1.1rem;
    color: var(--primary-text-color);
    display: grid;
    gap: 0.25rem;
    list-style-type: disc;
}

.hero-with-figure {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 1.25rem;
    align-items: center;
    background: linear-gradient(135deg, rgba(45, 79, 72, 0.06), rgba(212, 249, 83, 0.07));
    position: relative;
    overflow: hidden;
    min-height: 240px;
}

.hero-with-figure::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(at 85% 30%, rgba(212, 249, 83, 0.22), transparent 55%),
                radial-gradient(at 20% 80%, rgba(45, 79, 72, 0.18), transparent 50%);
    pointer-events: none;
    filter: blur(6px);
}

.hero-copy {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    z-index: 1;
}

.hero-mini-chat {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.4rem;
    max-width: 560px;
}

.hero-bubble {
    padding: 0.85rem 1rem;
    border-radius: 14px;
    line-height: 1.55;
    box-shadow: var(--shadow-soft);
    letter-spacing: 0.005em;
    max-width: 520px;
}

.hero-bubble.user-bubble {
    background: var(--user-message-bg);
    color: #f5f7f5;
    box-shadow: var(--shadow-glow);
}

.hero-bubble.ai-bubble {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    color: var(--secondary-text-color);
}

.hero-pills {
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.hero-figure {
    position: relative;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1;
}

.figure-backdrop {
    position: absolute;
    inset: 12px;
    background: radial-gradient(circle at 40% 30%, rgba(45, 79, 72, 0.16), transparent 55%),
                radial-gradient(circle at 70% 70%, rgba(212, 249, 83, 0.16), transparent 50%),
                rgba(255, 255, 255, 0.6);
    filter: blur(1px);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
}

.human-figure {
    position: relative;
    width: 68%;
    max-width: 220px;
    filter: drop-shadow(0 10px 24px rgba(0,0,0,0.06));
    mix-blend-mode: multiply;
}

.figure-rings {
    position: absolute;
    right: 0;
    top: 14px;
    display: grid;
    gap: 0.5rem;
}

.figure-ring {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    display: grid;
    place-content: center;
    color: var(--primary-text-color);
    box-shadow: var(--shadow-soft);
    background: #fff;
    position: relative;
    border: 1px solid var(--border-color);
}

.figure-ring::before {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
}

.figure-ring.primary-ring {
    background: conic-gradient(from 270deg, rgba(45, 79, 72, 0.12) 0 100%);
}

.figure-ring.secondary-ring {
    background: conic-gradient(from 270deg, rgba(45, 79, 72, 0.08) 0 100%);
}


.figure-ring .ring-label {
    font-size: 0.7rem;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    z-index: 1;
    text-align: center;
}

.figure-ring .ring-value {
    font-weight: 700;
    font-size: 1.1rem;
    z-index: 1;
    text-align: center;
}


.figure-chip {
    position: absolute;
    left: 8px;
    bottom: 14px;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 0.2rem;
    max-width: 220px;
}

.figure-chip .chip-title {
    font-weight: 700;
    color: var(--secondary-text-color);
}

.figure-chip .chip-sub {
    color: var(--muted-text);
    font-size: 0.9rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--secondary-text-color);
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
}

.pill-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid rgba(15, 178, 141, 0.2);
    color: var(--secondary-text-color);
    background: rgba(255, 255, 255, 0.85);
}

.pill.success {
    background: rgba(15, 178, 141, 0.12);
    color: #0f6b5a;
    border-color: rgba(15, 178, 141, 0.35);
}

.pill.muted { color: var(--muted-text); }

/* Banner superior e inferior tipo AdSense */

.ad-top, .ad-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem;
}

.ad-top {
    min-height: 52px;
    max-width: 880px;
    width: 100%;
}

.ad-bottom {
    min-height: 52px;
    max-width: 100%;
    border: 1px dashed rgba(15, 178, 141, 0.25);
}

.chat-ad-card {
    margin: 0.35rem auto 1.1rem;
    padding: 0.35rem 0.4rem;
    border-radius: 16px;
    border: 1px solid rgba(15, 178, 141, 0.1);
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-width: 1020px;
    width: min(98%, 1020px);
    align-items: center;
}

.chat-ad-card .ad-label {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 700;
    width: 100%;
}

.chat-ad-card .ad-body {
    background: transparent;
    border-radius: 16px;
    padding: 0;
    width: 100%;
}

.ad-banner-shell {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.95rem;
    border-radius: 18px;
    background: linear-gradient(135deg, #ffffff, #f6fbf9);
    border: 1px solid rgba(18, 68, 54, 0.12);
    box-shadow: 0 18px 36px -28px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.4) inset;
    position: relative;
    overflow: hidden;
    min-height: 78px;
}

.ad-banner-shell::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle at center, rgba(15, 178, 141, 0.18), transparent 60%);
    pointer-events: none;
}

.ad-banner-headline {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    color: #0d1d1b;
}

.ad-eyebrow {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #0f7c5d;
}

.ad-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 800;
    color: #0c1f1b;
}

.ad-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: #3a4744;
}

.ad-cta {
    border: none;
    background: linear-gradient(135deg, #2b8cff, #0f7cff);
    color: #ffffff;
    font-weight: 800;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    box-shadow: 0 12px 30px -16px rgba(15, 124, 255, 0.8);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ad-cta:hover,
.ad-cta:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px -14px rgba(15, 124, 255, 0.9);
}

.ad-cta:active {
    transform: translateY(0);
}

.ad-slot {
    margin-top: 0.4rem;
    width: 100%;
    display: block;
    position: relative;
    min-height: 90px;
}

.ad-slot ins.adsbygoogle {
    display: block;
    width: 100%;
    min-height: 90px;
}

.habit-announce-card {
    margin: 0.5rem 0 1.15rem;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    border: 1px solid rgba(15, 178, 141, 0.18);
    background: linear-gradient(145deg, rgba(9, 32, 26, 0.7), rgba(12, 59, 46, 0.55));
    box-shadow: 0 16px 42px -26px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.habit-announce-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.habit-announce-top h3 {
    margin: 0.1rem 0 0.35rem;
    font-size: 1.15rem;
    color: #e8f7f0;
}

.habit-announce-copy {
    margin: 0;
    color: rgba(232, 247, 240, 0.82);
    font-size: 0.98rem;
}

.habit-announce-actions {
    flex-shrink: 0;
}

.habit-announce-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.habit-stat {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.habit-stat .stat-label {
    display: block;
    color: rgba(232, 247, 240, 0.75);
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.habit-stat .stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    color: #62f9c0;
}

.habit-stat .stat-sub {
    display: block;
    color: rgba(232, 247, 240, 0.78);
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

.habit-announce-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.habit-announce-chips .habit-chip {
    border: 1px solid rgba(98, 249, 192, 0.4);
    background: rgba(98, 249, 192, 0.08);
    color: #e8f7f0;
    padding: 0.4rem 0.65rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.92rem;
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.habit-announce-chips .habit-chip:hover,
.habit-announce-chips .habit-chip:focus-visible {
    background: rgba(98, 249, 192, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px -18px rgba(98, 249, 192, 0.8);
}

.habit-announce-chips .habit-chip .chip-status {
    font-size: 0.78rem;
    color: rgba(232, 247, 240, 0.85);
}

@media (max-width: 1024px) {
    .chat-ad-card {
        display: none;
    }

    .habit-announce-card {
        margin: 0.35rem 0 0.95rem;
        padding: 0.85rem 0.9rem;
    }

    .habit-announce-top {
        flex-direction: column;
        gap: 0.5rem;
    }

    .habit-announce-actions {
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }
}

.chat-shell {
    padding: 0.9rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    flex: 1;                /* ocupa el espacio disponible dentro de chat-main */
}

.chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.session-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.session-meta .label {
    margin: 0;
    font-weight: 700;
}

.session-meta .sub-label {
    margin: 0;
    color: var(--muted-text);
    font-size: 0.9rem;
}

.session-mode-indicator {
    font-weight: 600;
    color: var(--secondary-text-color);
}

.session-meta .dot {
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.12);
}

.quick-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.quick-actions.compact {
    background: rgba(15, 178, 141, 0.06);
    border-radius: 14px;
    padding: 0.35rem 0.55rem;
    border: 1px solid rgba(15, 178, 141, 0.12);
}

.quick-actions .sub-label {
    font-weight: 600;
    color: var(--secondary-text-color);
    margin: 0 0.2rem 0 0;
}

.mode-buttons {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.mode-buttons.inline {
    flex-wrap: nowrap;
}

.chip {
    border: 1px solid rgba(15, 178, 141, 0.35);
    background: rgba(255, 255, 255, 0.9);
    color: var(--secondary-text-color);
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.chip:hover {
    background: rgba(15, 178, 141, 0.1);
    transform: translateY(-1px);
}

.chip.mode-chip.active-mode {
    background: linear-gradient(120deg, #15c39a, #0ca47f);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(15, 178, 141, 0.25);
}

.prompt-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.prompt-chips.inline {
    flex-wrap: nowrap;
}

/* Área del chat (mensajes + bienvenida) */

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.9rem 0.7rem 0.45rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(244,255,251,0.95));
    border: 1px solid rgba(15, 178, 141, 0.08);
    border-radius: 18px;
    box-shadow: var(--shadow-inner), 0 10px 28px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

/* Mensaje de bienvenida */
.welcome-message {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem 1rem;
    flex-direction: column;
    gap: 2rem;
}

.metrics-sidebar {
    width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.metrics-main-card {
    border-radius: 28px;
    padding: 18px 18px 20px;
    background: radial-gradient(circle at 0 0, #f5fff9 0, #e8faf5 35%, #f4fbff 100%);
    box-shadow: 0 18px 40px rgba(6, 75, 58, 0.10);
    border: 1px solid rgba(10, 138, 104, 0.10);
}

.metrics-main-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metrics-main-top {
    display: flex;
    gap: 16px;
    align-items: center;
}

.ring-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring-wrapper canvas {
    position: absolute;
    inset: 0;
}

.ring-center-label {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ring-center-label span:first-child {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0a8a68;
}

.ring-center-label span:last-child {
    font-size: 0.75rem;
    color: #7a8a93;
}

.metrics-main-summary .metrics-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: #1e2b33;
}

.metrics-caption {
    font-size: 0.8rem;
    margin: 0 0 8px;
    color: #60717b;
}

.metrics-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge-soft {
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    color: #2d6f56;
}

.badge-outline {
    background: transparent;
    border: 1px solid rgba(13, 148, 136, 0.25);
}

.metrics-main-section {
    padding-top: 8px;
    border-top: 1px dashed rgba(15, 184, 143, 0.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.metrics-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.metrics-label {
    font-size: 0.78rem;
    color: #81939f;
}

.metrics-value {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 2px 0;
}

.metrics-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    background: #ecfdf3;
    color: #137a4c;
}

.metrics-link {
    border: none;
    background: rgba(255, 255, 255, 0.7);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    color: #166f5b;
    cursor: pointer;
}

.metrics-chart-wrapper {
    margin-top: 10px;
}

.metrics-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 14px 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.03);
}

.metrics-card.secondary h3 {
    font-size: 0.9rem;
    margin: 0 0 4px;
}

.metrics-subtitle {
    font-size: 0.8rem;
    color: #6b7b86;
    margin: 0 0 6px;
}

.habits-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}

.habit-drawer-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.habit-drawer-stack h3 {
    margin: 0;
}

/* Ítems de hábitos en el lateral derecho */
.habit-sidebar-item {
    padding: 8px 10px;
    border-radius: 14px;
    background: #f7fbf9;
    border: 1px solid rgba(15, 76, 58, 0.04);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.habit-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.habit-sidebar-title {
    font-size: 0.84rem;
    font-weight: 600;
    color: #0f172a;
}

.habit-sidebar-status {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: #ecfdf3;
    color: #166534;
}

.habit-sidebar-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.72rem;
    color: #6b7280;
}

.habit-sidebar-meta {
    display: inline-flex;
    align-items: center;
}

.habit-sidebar-actions {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pill-button.pill-compact {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 0.75rem;
}

.habit-empty {
    font-size: 0.78rem;
    color: #6b7280;
    padding: 6px 4px 2px;
}

.body-card {
    display: flex;
    gap: 14px;
    align-items: center;
}

.body-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.body-wrapper img,
.body-wrapper svg {
    max-height: 120px;
    width: auto;
}

.body-metrics {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.body-pill {
    padding: 6px 10px;
    border-radius: 999px;
    background: #f1fbff;
    font-size: 0.78rem;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.body-pill:nth-child(2) {
    background: #f3fff7;
}

.body-pill:nth-child(3) {
    background: #fdf7ff;
}

.pill-label {
    color: #60717b;
}

.pill-value {
    font-weight: 600;
    color: #1e2b33;
}

@media (max-width: 1024px) {
    .chat-layout {
        flex-direction: column;
    }

    .metrics-sidebar {
        width: 100%;
        order: 2;
        display: none;
    }
}

.welcome-message h2 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #111827 0%, #4B5563 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

/* Contenedor de mensajes */
.chat-messages {
    flex: 1;
    padding: 0 1.5rem 1.75rem; /* espacio más corto abajo, pegado al input */
    max-width: 48rem;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: visible;
}

/* Burbujas de mensajes */

.message {
    padding: 1.25rem 1.5rem;
    border-radius: 20px;
    max-width: 75%;
    line-height: 1.65;
    word-wrap: break-word;
    animation: slideUpFade 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin-bottom: 1.5rem;
    font-size: 0.98rem;
    letter-spacing: 0.01em;
    border: none;
    position: relative;
    transition: transform 0.2s ease;
}

.orb-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.25rem;
}

.orb-message .consciousness-orb {
    width: 80px;
    height: 80px;
    position: relative;
    display: block;
    margin-left: 12px;
    flex-shrink: 0;
    z-index: 10;

    /* Orbe base: cápsula luminosa para el gatito médico */
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #e0f7f2 45%, #b3ece2 100%);
    border: 2px solid rgba(79, 209, 197, 0.32);
    box-shadow:
        0 0 18px rgba(79, 209, 197, 0.45),
        0 0 36px rgba(79, 209, 197, 0.25),
        inset 0 0 12px rgba(0, 0, 0, 0.16);

    animation: pulse 4s ease-in-out infinite;
    transition: all 0.5s ease;
}

.orb-message-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.orb-message-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.orb-title {
    margin: 0;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.orb-subtitle {
    margin: 0;
    color: #475569;
    font-size: 0.92rem;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-message {
    background: var(--user-message-bg);
    color: var(--user-text);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-glow);
    margin-left: 2rem;
    font-weight: 500;
}

.ai-message {
    background-color: var(--ai-message-bg);
    color: var(--secondary-text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
    margin-right: 2rem;
}

.ai-message {
    border: 1px solid rgba(0,0,0,0.03);
}
/* Permite que una respuesta de la IA parezca múltiples mensajes */
.ai-message .split-bubble {
    display: block;
    margin-bottom: 12px; /* Espacio entre párrafos */
}

.ai-message .split-bubble:last-child {
    margin-bottom: 0;
}

/* Separación visual entre párrafos de la IA como si fueran mensajes sucesivos */
.ai-message p {
    margin-bottom: 1rem;
}

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

/* Modificadores de emoción para el mensaje de la IA */
.ai-message.mood-empathetic {
    background: linear-gradient(135deg, #FDFBF7 0%, #FFF4E6 100%);
    border-left: 3px solid #FDBA74;
}

.ai-message.mood-excited {
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border-left: 3px solid #4ADE80;
}

.ai-message.mood-serious {
    background: #F8FAFC;
    border-left: 3px solid #94A3B8;
}


.md-list {
    padding-left: 1.1rem;
    margin: 0.35rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.md-list li {
    color: var(--secondary-text-color);
    line-height: 1.5;
}

.message h1,
.message h2,
.message h3,
.message h4,
.message h5,
.message h6 {
    margin: 0.35rem 0 0.2rem;
    font-weight: 650;
    color: var(--secondary-text-color);
    letter-spacing: -0.01em;
}

.message h4,
.message h5,
.message h6 {
    font-size: 0.98rem;
}

.message ul,
.message ol {
    padding-left: 1.1rem;
    margin: 0.35rem 0 0.6rem;
    color: var(--secondary-text-color);
    line-height: 1.55;
}

.message table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 0.9rem;
    font-size: 0.92rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.message table thead {
    background: rgba(15, 76, 58, 0.05);
}

.message table th,
.message table td {
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(15, 76, 58, 0.08);
    text-align: left;
}

.md-paragraph {
    margin: 0.2rem 0;
    line-height: 1.6;
    color: var(--secondary-text-color);
}

/* === Tema estilo ChatGPT para chat.html === */
body.chatgpt-clone {
    background: #ffffff;
    color: #1f2937;
    font-family: "Inter", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.chatgpt-clone .chat-container {
    background: #ffffff;
    grid-template-columns: 280px 1fr;
}

body.chatgpt-clone .sidebar {
    background: #f7f7f8;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
    height: 100vh;
    padding: 1.25rem 1rem;
}

body.chatgpt-clone .sidebar .sidebar-section-title,
body.chatgpt-clone .sidebar a,
body.chatgpt-clone .sidebar span,
body.chatgpt-clone .sidebar p {
    color: #1f2937;
}

body.chatgpt-clone .brand-mark {
    gap: 0.65rem;
    align-items: center;
}

body.chatgpt-clone .brand-mark::before {
    display: none;
}

body.chatgpt-clone .logo-chatgpt svg {
    width: 38px;
    height: 38px;
    display: block;
}

body.chatgpt-clone .sidebar-header .logo {
    background: transparent;
    border-radius: 10px;
    box-shadow: none;
}

body.chatgpt-clone .brand-title {
    color: #111827;
    font-weight: 800;
    letter-spacing: -0.01em;
}

body.chatgpt-clone .brand-subtitle {
    display: none;
}

body.chatgpt-clone #new-chat-btn {
    background: #10A37F;
    color: #fff;
    border: 1px solid #0E8E6F;
    border-radius: 12px;
    box-shadow: none;
    font-weight: 600;
}

body.chatgpt-clone #new-chat-btn svg {
    fill: currentColor;
}

body.chatgpt-clone #new-chat-btn:hover {
    background: #0E8E6F;
}

body.chatgpt-clone .sidebar-menu li a {
    border-radius: 10px;
    color: #111827;
    border: 1px solid transparent;
    text-decoration: none;
}

body.chatgpt-clone .sidebar-menu li a:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

body.chatgpt-clone .sidebar-menu li a span,
body.chatgpt-clone #new-chat-btn span {
    text-decoration: none;
}

body.chatgpt-clone .main-panel {
    background: #ffffff;
}

body.chatgpt-clone .chat-shell {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

body.chatgpt-clone .chat-toolbar {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding-inline: 0.75rem;
    max-width: 960px;
    margin: 0 auto;
}

body.chatgpt-clone .session-meta .dot {
    background: #10A37F;
}

body.chatgpt-clone .chat-area {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
}

body.chatgpt-clone .welcome-card,
body.chatgpt-clone .welcome-card-shell {
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

body.chatgpt-clone .welcome-card-placeholder,
body.chatgpt-clone .welcome-card-label,
body.chatgpt-clone .welcome-chip-text {
    color: #111827;
}

body.chatgpt-clone .welcome-chip {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #111827;
}

body.chatgpt-clone .chat-messages {
    padding: 0.75rem 1.5rem 2.25rem;
    gap: 1.1rem;
    align-items: stretch;
    max-width: 960px;
    margin: 0 auto;
}

body.chatgpt-clone .message {
    width: fit-content;
    max-width: min(72ch, calc(100% - 3rem));
    border-radius: 16px;
    margin: 0;
    padding: 1rem 1.1rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-align: left;
}

body.chatgpt-clone .user-message {
    background: #e8faf4;
    color: #0f172a;
    align-self: flex-end;
    align-items: flex-start;
    margin-left: auto;
    margin-right: 0.5rem;
    box-shadow: 0 4px 14px rgba(16, 163, 127, 0.18);
    border-color: #cdeee3;
}

body.chatgpt-clone .ai-message {
    background: #ffffff;
    color: #0f172a;
    align-self: flex-start;
    margin-right: auto;
    border-color: #e5e7eb;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    align-items: flex-start;
}

body.chatgpt-clone .chat-input-wrapper {
    background: #ffffff;
    border: 1px solid #d1d5db;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
    padding: 0.85rem 1rem;
}

body.chatgpt-clone #chat-input {
    background: transparent;
    color: #111827;
}

body.chatgpt-clone #chat-input::placeholder {
    color: #9ca3af;
}

body.chatgpt-clone .chat-input-wrapper button {
    background: none;
    color: #111827;
    border: none;
}

body.chatgpt-clone #send-btn {
    background: #10A37F;
    border-radius: 10px;
    color: #fff;
    padding: 0.45rem 0.7rem;
}

body.chatgpt-clone #send-btn:hover {
    background: #0E8E6F;
}

body.chatgpt-clone .metrics-sidebar,
body.chatgpt-clone .metrics-card,
body.chatgpt-clone .metrics-main-card,
body.chatgpt-clone .chat-ad-card,
body.chatgpt-clone .ad-banner-shell {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.05);
    color: #111827;
}

body.chatgpt-clone .chat-ad-card .ad-label,
body.chatgpt-clone .chat-ad-card .ad-title,
body.chatgpt-clone .chat-ad-card .ad-subtitle,
body.chatgpt-clone .chat-ad-card .ad-eyebrow {
    color: #111827;
}

body.chatgpt-clone .metrics-chip,
body.chatgpt-clone .badge-soft,
body.chatgpt-clone .badge-outline {
    background: #f3f4f6;
    color: #111827;
    border: 1px solid #e5e7eb;
}

body.chatgpt-clone .chat-input-area {
    border-top: 1px solid #e5e7eb;
    background: linear-gradient(180deg, rgba(247,247,248,0.95) 0%, rgba(255,255,255,1) 70%);
}

body.chatgpt-clone .mobile-nav-toggle,
body.chatgpt-clone .sidebar-toggle {
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
}

body.chatgpt-clone .sidebar-toggle:hover {
    background: #f3f4f6;
}

.progress-card {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 178, 141, 0.08), rgba(255, 255, 255, 0.95));
    border: 1px solid rgba(15, 178, 141, 0.18);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.health-score-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0.5rem 0.9rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(21, 195, 154, 0.14), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(15, 178, 141, 0.18);
}

.health-score-card.health-score-rusty {
    background: linear-gradient(135deg, rgba(229, 133, 27, 0.12), rgba(255, 255, 255, 0.94));
    border-color: rgba(229, 133, 27, 0.18);
    box-shadow: 0 12px 30px rgba(229, 133, 27, 0.08);
}

.health-score-ring {
    position: relative;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #ffffff 55%, rgba(15, 178, 141, 0.14) 60%);
    overflow: hidden;
    flex-shrink: 0;
}

.health-score-card.health-score-rusty .health-score-ring {
    background: radial-gradient(circle at 50% 50%, #ffffff 55%, rgba(229, 133, 27, 0.16) 60%);
}

.health-score-ring-fill {
    position: absolute;
    inset: 0;
}

.health-score-ring-center {
    position: absolute;
    inset: 18px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.15rem;
    box-shadow: inset 0 0 0 1px rgba(15, 178, 141, 0.12);
}

.health-score-value {
    font-weight: 700;
    font-size: 1.2rem;
    color: #0f8b72;
}

.health-score-card.health-score-rusty .health-score-value {
    color: #b45309;
}

.health-score-label {
    font-size: 0.78rem;
    color: var(--muted-text);
}

.health-score-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.health-score-title {
    margin: 0;
    font-weight: 700;
    color: var(--secondary-text-color);
}

.health-score-helper {
    margin: 0;
    color: var(--muted-text);
    font-size: 0.9rem;
}

.ai-evolution-card {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.1rem;
}

.ai-evolution-main-row {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.ai-evolution-chart-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.ai-evolution-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

.ai-evolution-chart-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.ai-evolution-chart-center span:first-child {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1;
}

.ai-evolution-chart-center span:last-child {
    font-size: 0.72rem;
    color: var(--muted-text);
    margin-top: 0.1rem;
}

.ai-evolution-text-col {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.ai-evolution-log {
    margin-top: 0.3rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(15, 76, 58, 0.14);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.ai-evolution-log-empty {
    font-size: 0.8rem;
    color: var(--muted-text);
}

.ai-evolution-log-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--secondary-text-color);
}

.ai-evolution-log-time {
    font-size: 0.72rem;
    color: var(--muted-text);
    white-space: nowrap;
}

/* Bordes laterales según tipo */
.ai-evolution-log-item--clinical {
    border-left: 3px solid rgba(16, 185, 129, 0.6);
    padding-left: 6px;
}

.ai-evolution-log-item--format {
    border-left: 3px solid rgba(14, 165, 233, 0.6);
    padding-left: 6px;
}

.ai-evolution-log-item--behavior {
    border-left: 3px solid rgba(245, 158, 11, 0.7);
    padding-left: 6px;
}

.ai-evolution-log-item--persona {
    border-left: 3px solid rgba(99, 102, 241, 0.7);
    padding-left: 6px;
}

.ai-evolution-log-item--error {
    border-left: 3px solid rgba(239, 68, 68, 0.7);
    padding-left: 6px;
}

.ai-evolution-log-item--info {
    border-left: 3px solid rgba(107, 114, 128, 0.5);
    padding-left: 6px;
}

.progress-header {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--secondary-text-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.progress-header-title {
    display: flex;
    flex-direction: column;
}

.progress-link {
    border: none;
    background: transparent;
    color: var(--accent-color, #0f8b72);
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.progress-link:hover {
    color: #0c735e;
}

.progress-subheader {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--secondary-text-color);
}

.progress-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.progress-metric-label {
    display: flex;
    justify-content: space-between;
    color: var(--muted-text);
}

.progress-bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(15, 178, 141, 0.12);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(120deg, #15c39a, #0ca47f);
    width: 0%;
    transition: width 0.4s ease-out;
}

.progress-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    border: 1px solid rgba(15, 178, 141, 0.25);
    color: var(--secondary-text-color);
    background: rgba(255, 255, 255, 0.85);
    width: fit-content;
}

.progress-task-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.progress-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.story-capture-frame {
    position: fixed;
    left: -9999px;
    top: -9999px;
    width: 360px;
    padding: 1rem;
    border-radius: 16px;
    background: linear-gradient(180deg, #f6fbf8, #ffffff);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.story-headline {
    font-weight: 800;
    font-size: 1.05rem;
    color: #0f8b72;
}

.story-clone {
    width: 100%;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
}

.task-item {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(15, 178, 141, 0.12);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.03);
}

.task-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.task-title {
    margin: 0;
    font-weight: 600;
    color: var(--secondary-text-color);
}

.task-description {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted-text);
}

.task-meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted-text);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chart-card {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 178, 141, 0.08), rgba(255, 255, 255, 0.97));
    border: 1px solid rgba(15, 178, 141, 0.16);
    box-shadow: 0 8px 18px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.chart-header {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--secondary-text-color);
}

.chart-subtitle {
    font-size: 0.86rem;
    color: var(--muted-text);
    line-height: 1.45;
}

.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 170px;
}

.progress-chart-section {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.progress-chart-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    opacity: 0.9;
}

.chart-note {
    font-size: 0.78rem;
    color: var(--muted-text);
}

/* ===== Modales genéricos para hábitos y métricas ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal.hidden {
    display: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.modal-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    color: var(--muted-text);
    margin: 0 0 0.15rem;
}

.modal-sub {
    margin: 0;
    color: var(--muted-text);
    font-size: 0.9rem;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 1.1rem 1.2rem 1.3rem;
    width: min(420px, 92vw);
    box-shadow: 0 16px 36px rgba(0,0,0,0.15);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.modal-content h3 {
    margin: 0 0 0.3rem;
    font-size: 1.05rem;
    color: var(--secondary-text-color);
}

.modal-content label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.modal-content input,
.modal-content select,
.modal-content textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 0.55rem 0.65rem;
    font-size: 0.9rem;
    background: rgba(249, 252, 251, 0.85);
    color: var(--text-color);
}

.modal-content textarea {
    resize: vertical;
}

.clinical-modal .modal-content {
    width: min(860px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(255,255,255,0.98), rgba(241, 252, 247, 0.96));
    border: 1px solid rgba(15, 178, 141, 0.14);
    box-shadow: 0 20px 60px rgba(0,0,0,0.14);
    padding: 1.4rem 1.5rem 1.2rem;
}

.medication-modal {
    width: min(620px, 95vw);
    max-height: 88vh;
    overflow-y: auto;
    background: linear-gradient(150deg, rgba(255,255,255,0.98), rgba(236, 253, 245, 0.96));
    border: 1px solid rgba(15, 178, 141, 0.12);
    box-shadow: 0 18px 48px rgba(0,0,0,0.12);
}

.medications-list {
    margin-bottom: 16px;
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.medication-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(249, 252, 251, 0.95);
    border: 1px solid rgba(15, 178, 141, 0.1);
    border-radius: 12px;
    gap: 12px;
}

.medication-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.medication-name {
    font-weight: 700;
    color: #1f2937;
}

.medication-details {
    font-size: 0.9rem;
    color: var(--muted-text);
}

.medication-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.medication-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.medication-form input,
.medication-form select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    background: rgba(249, 252, 251, 0.85);
    color: var(--text-color);
}

.medication-form .pill-button {
    align-self: flex-start;
}

.empty-state {
    color: var(--muted-text);
    margin: 0;
    padding: 8px 0;
}

@media (max-width: 640px) {
    .medication-grid {
        grid-template-columns: 1fr;
    }

    .medication-modal {
        width: min(520px, 96vw);
    }
}

.clinical-profile-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.clinical-section {
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(15, 178, 141, 0.12);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 10px 28px rgba(0,0,0,0.05);
}

.clinical-section-title {
    font-weight: 700;
    color: var(--secondary-text-color);
    margin-bottom: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.1rem 0.35rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(15, 178, 141, 0.14), rgba(12, 164, 127, 0.08));
}

.clinical-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.clinical-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.92rem;
    color: var(--secondary-text-color);
}

.clinical-field .input-field,
.clinical-field textarea,
.clinical-field select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(15, 178, 141, 0.18);
    padding: 10px 12px;
    background: rgba(249, 253, 251, 0.9);
    transition: border 0.15s ease, box-shadow 0.15s ease;
}

.clinical-field .input-field:focus,
.clinical-field textarea:focus,
.clinical-field select:focus {
    border-color: rgba(15, 178, 141, 0.5);
    box-shadow: 0 0 0 3px rgba(15, 178, 141, 0.15);
    outline: none;
}

.clinical-divider {
    border: 0;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    margin: 0;
}

.clinical-modal-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(249,253,251,0.96));
    padding-top: 0.65rem;
    margin-top: 0.2rem;
    border-top: 1px solid rgba(15, 178, 141, 0.12);
}

.full-width {
    grid-column: span 2;
}

@media (max-width: 700px) {
    .clinical-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: span 1;
    }
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--muted-text);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.pill-button {
    border: 1px solid rgba(15, 178, 141, 0.35);
    background: linear-gradient(135deg, rgba(21, 195, 154, 0.12), rgba(12, 164, 127, 0.12));
    color: var(--secondary-text-color);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 18px rgba(0,0,0,0.04);
}

.pill-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(0,0,0,0.08);
}

.pill-button.ghost {
    background: #fff;
    border-color: rgba(15, 178, 141, 0.2);
    color: var(--muted-text);
    box-shadow: none;
}

.task-activation-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    background: linear-gradient(135deg, rgba(15, 178, 141, 0.1), rgba(255,255,255,0.95));
    border: 1px solid rgba(15, 178, 141, 0.2);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
}

.nutrition-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: linear-gradient(135deg, rgba(15, 178, 141, 0.06), rgba(255, 255, 255, 0.96));
    border: 1px solid rgba(15, 178, 141, 0.22);
    border-radius: 14px;
    padding: 1rem 1.05rem;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.05);
}

.nutrition-card-title {
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--secondary-text-color);
}

.nutrition-card-copy {
    margin: 0;
    color: var(--muted-text);
    font-size: 0.9rem;
    line-height: 1.5;
}

.nutrition-date-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nutrition-date-input {
    padding: 0.4rem 0.6rem;
    border-radius: 10px;
    border: 1px solid rgba(15, 178, 141, 0.25);
    background: #fff;
    font-size: 0.9rem;
}

.nutrition-preview {
    padding-left: 1.1rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    color: var(--muted-text);
    font-size: 0.9rem;
}

.nutrition-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nutrition-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.nutrition-table th,
.nutrition-table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid rgba(15, 178, 141, 0.12);
    text-align: left;
}

.nutrition-table th {
    font-weight: 600;
    color: var(--secondary-text-color);
    background: rgba(15, 178, 141, 0.06);
}

.nutrition-table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.8);
}

.task-activation-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.error-message {
    color: #b91c1c;
    font-weight: 500;
}

.thinking-message {
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #4b5563;
    background: #f7f7f8;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 20px -18px rgba(0, 0, 0, 0.35), var(--shadow-sm);
    border-radius: 14px;
    padding: 0.45rem 0.85rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.thinking-indicator::before {
    display: none;
}

.thinking-label {
    position: relative;
    z-index: 1;
}

.thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    z-index: 1;
}

.thinking-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: thinkingPulse 0.9s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.12s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.24s; }

@keyframes thinkingPulse {
    0% { transform: translateY(0); opacity: 0.55; }
    50% { transform: translateY(-3px); opacity: 1; }
    100% { transform: translateY(0); opacity: 0.55; }
}

/* ---------- INPUT FLOTANTE ---------- */

.chat-input-area {
    background: transparent;
    padding: 0 1.5rem 1.5rem;
    position: sticky;
    bottom: 0;
    z-index: 20;
    pointer-events: none;
    margin-top: auto; /* empuja el input hacia abajo cuando hay poco contenido */
}

.chat-input-wrapper {
    pointer-events: auto;
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    max-width: 48rem;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.1);
    border-radius: 24px;
    padding: 0.75rem 1rem;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
                box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
                border-color 0.2s ease;
}

.chat-input-wrapper:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(15, 76, 58, 0.15);
    border-color: var(--brand-secondary);
}

/* Confetti feedback para hábitos completados */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1200;
}

.confetti-piece {
    position: absolute;
    top: 10%;
    width: 10px;
    height: 18px;
    border-radius: 4px;
    opacity: 0.95;
    animation: confetti-fall 1s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(120vh) rotate(360deg);
        opacity: 0;
    }
}

#chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 1.05rem;
    padding: 0.45rem 0.85rem;
    background: transparent;
    max-height: 200px;
    min-height: 24px;
    line-height: 1.5;
    font-family: inherit;
    color: var(--primary-text-color);
}

#chat-input::placeholder {
    color: #9ca3af;
}

#chat-input:disabled {
    background-color: transparent;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Botones de acción en el input */

.chat-input-wrapper button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.55rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 14px;
}

.chat-input-wrapper button:hover:not(:disabled) {
    color: var(--primary-text-color);
    background-color: rgba(16, 185, 129, 0.08);
}

.chat-input-wrapper button:active:not(:disabled) {
    transform: scale(0.98);
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.input-icons svg {
    width: 22px;
    height: 22px;
    color: var(--muted-text);
}

#send-btn {
    background-color: var(--button-bg);
    color: var(--button-text-color);
    border-radius: 18px;
    width: 38px;
    height: 38px;
    margin-left: 0.35rem;
    transition: all 0.2s;
    box-shadow: 0 10px 25px rgba(15, 178, 141, 0.35);
}

#send-btn:hover:not(:disabled) {
    background-color: var(--button-bg-strong);
    transform: translateY(-1px) scale(1.03);
}

#send-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: scale(1);
    box-shadow: none;
}

#mic-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(15, 178, 141, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

#mic-btn svg {
    width: 20px;
    height: 20px;
}

#mic-btn:hover:not(:disabled) {
    background: rgba(15, 178, 141, 0.20);
    transform: translateY(-1px);
}

#mic-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Estado grabando */
#mic-btn.mic-recording {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.8);
    color: #fecaca;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.5);
    animation: mic-pulse 1s ease-in-out infinite;
}

#voice-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(15, 118, 110, 0.3);
    background: rgba(15, 178, 141, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

#voice-toggle-btn svg {
    width: 20px;
    height: 20px;
}

/* Estado activo (voz encendida) */
#voice-toggle-btn.active {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.8);
    color: #047857;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.4);
}

@keyframes mic-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.ad-rail {
    position: sticky;
    top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-self: start;
}

.ad-card {
    padding: 0.75rem;
    background: var(--glass);
    border: 1px solid rgba(15, 178, 141, 0.12);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
}

/* ---------- ADS RESPONSIVE ---------- */

@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .ad-rail {
        display: none;
    }

    .hero-with-figure {
        grid-template-columns: 1fr;
        row-gap: 0.5rem;
    }

    .figure-rings {
        right: 10px;
        top: 10px;
    }
}

@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        z-index: 100;
        transition: left 0.3s;
    }

    .sidebar.open {
        left: 0;
    }

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

    body.sidebar-open {
        overflow: hidden;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        position: sticky;
        top: 0.75rem;
        z-index: 110;
        margin-left: 0.1rem;
    }

    .ad-top, .ad-bottom {
        max-width: 320px;
        min-height: 50px;
    }

    .chat-shell {
        padding: 0.75rem 0.85rem 1rem;
    }

    .chat-messages {
        padding: 0 1rem 7rem;
        max-width: 100%;
    }

    .message {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .chat-input-wrapper {
        max-width: 100%;
    }

    .chat-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .hero-with-figure {
        grid-template-columns: 1fr;
    }

    .hero-figure {
        min-height: 200px;
    }

    .figure-ring {
        width: 82px;
        height: 82px;
    }

    .chat-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .welcome-message h2 {
        font-size: 1.5rem;
    }

    .main-panel {
        padding: 1rem 0.75rem 0.75rem;
    }
}

@media (max-width: 560px) {
    .chat-hero {
        padding: 0.85rem 0.95rem;
    }

    .chat-hero h2 {
        font-size: 1.25rem;
        line-height: 1.35;
    }

    .hero-bubble,
    .hero-bubble.ai-bubble,
    .hero-bubble.user-bubble {
        font-size: 0.95rem;
    }

    .hero-figure {
        display: none;
    }

    .chat-toolbar {
        gap: 0.7rem;
    }

    .quick-actions {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .mode-buttons,
    .prompt-chips {
        width: 100%;
        flex-wrap: wrap;
    }

    .ad-top,
    .ad-bottom {
        max-width: 100%;
    }
}

/* Scrollbar suave para toda la página */

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

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

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.chat-heading {
    margin: 0.4rem 0 0.2rem;
    font-weight: 600;
    color: var(--secondary-text-color);
}

.chat-divider {
    border: none;
    border-top: 1px solid rgba(15, 178, 141, 0.2);
    margin: 0.8rem 0;
}

.chat-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.2rem 0 0.7rem;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    overflow: hidden;
}

.chat-table thead {
    background: rgba(15, 178, 141, 0.06);
}

.chat-table th,
.chat-table td {
    padding: 0.4rem 0.6rem;
    border: 1px solid rgba(15, 178, 141, 0.15);
    text-align: left;
}

.chat-table th {
    font-weight: 600;
    color: var(--secondary-text-color);
}

.chat-table td {
    color: var(--muted-text);
}

.chat-bubble-chart {
    display: block;
    visibility: visible;
    margin-top: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 0.65rem 0.8rem 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(15, 76, 58, 0.06);
}

.chat-bubble-chart-header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0.4rem;
}

.chat-bubble-chart-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.chat-bubble-chart-title::before {
    content: '📊';
    font-size: 0.9rem;
}

.chat-bubble-chart-note {
    font-size: 0.78rem;
    color: var(--muted-text);
}

.chat-bubble-chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 160px;
}

/* ========================================================================
   HEALTHIA — Soft panels (match "Gráfico propuesto" reference)
   ======================================================================== */

/* Panel base: fondo BLANCO, tipografía verde, padding premium */
.healthia-soft-panel {
    background: #FFFFFF;
    border: 1px solid rgba(15, 76, 58, 0.10);
    border-radius: 14px;
    padding: 16px 18px;
    margin: 10px 0 14px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

/* Título dentro del panel (usa Inter como la referencia) */
.healthia-soft-panel h1,
.healthia-soft-panel h2,
.healthia-soft-panel h3 {
    margin: 0 0 10px !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em;
    color: var(--brand-primary) !important;
    line-height: 1.15;
}

.healthia-soft-panel h3 {
    font-size: 1.45rem !important;
}

/* Texto del panel */
.healthia-soft-panel p {
    margin: 0 !important;
    font-size: 1.05rem;
    line-height: 1.65;
    color: rgba(15, 76, 58, 0.92);
}

.chat-bubble-social-mirror {
    margin-top: 0.55rem;
    border-radius: 14px;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(120deg, rgba(16,185,129,0.08), rgba(15,76,58,0.03));
    border: 1px solid rgba(16,185,129,0.15);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.social-mirror-header {
    flex: 1 1 auto;
}

.social-mirror-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brand-primary);
}

.social-mirror-sub {
    font-size: 0.78rem;
    color: var(--secondary-text-color);
}

.social-mirror-tribe {
    width: 100%;
    font-size: 0.86rem;
    color: var(--brand-primary);
    font-weight: 600;
    background: rgba(16, 185, 129, 0.14);
    border-radius: 12px;
    padding: 0.55rem 0.65rem;
    box-shadow: inset 0 0 0 1px rgba(16,185,129,0.18);
}

.social-mirror-canvas-wrap {
    width: 72px;
    height: 72px;
    flex: 0 0 auto;
    align-self: flex-start;
}

.social-mirror-cloud {
    width: 100%;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(15, 76, 58, 0.08);
    border-radius: 12px;
    padding: 0.45rem 0.6rem 0.55rem;
    box-shadow: var(--shadow-sm, 0 10px 22px -12px rgba(15, 76, 58, 0.16));
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.social-mirror-cloud-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--secondary-text-color);
}

.social-mirror-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.social-mirror-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(16,185,129,0.14), rgba(15,76,58,0.08));
    color: var(--brand-primary);
    font-size: calc(0.78rem * var(--chip-intensity, 1));
    font-weight: 600;
    letter-spacing: 0.005em;
    box-shadow: 0 4px 12px -8px rgba(15, 76, 58, 0.4), inset 0 0 0 1px rgba(16,185,129,0.18);
    backdrop-filter: blur(6px);
}

.chat-scale-card {
    margin-top: 0.75rem;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    box-shadow: var(--shadow-sm, 0 12px 24px -8px rgba(15, 76, 58, 0.12));
    border: 1px solid rgba(15, 76, 58, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.chat-scale__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
}

.chat-scale__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--secondary-text-color);
}

.chat-scale__chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.75rem;
    border-radius: 999px;
    background: rgba(15, 76, 58, 0.08);
    color: var(--secondary-text-color);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.chat-scale__instructions {
    background: rgba(15, 178, 141, 0.06);
    border: 1px solid rgba(15, 178, 141, 0.15);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    color: var(--secondary-text-color);
    line-height: 1.6;
}

.chat-scale__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-scale__item {
    border: 1px solid rgba(15, 76, 58, 0.08);
    border-radius: 14px;
    padding: 0.85rem 0.9rem;
    background: rgba(255,255,255,0.75);
}

.chat-scale__prompt {
    margin: 0 0 0.5rem;
    font-weight: 700;
    color: var(--secondary-text-color);
    font-size: 0.98rem;
}

.chat-scale__options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.chat-scale__option {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(15, 76, 58, 0.1);
    background: rgba(255,255,255,0.85);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-scale__option:hover,
.chat-scale__option:focus-within {
    border-color: rgba(15, 178, 141, 0.4);
    box-shadow: 0 12px 24px -10px rgba(15, 178, 141, 0.25);
}

.chat-scale__option input {
    accent-color: var(--brand-primary, #0F4C3A);
    width: 16px;
    height: 16px;
}

.chat-scale__option-label {
    font-weight: 600;
    color: var(--secondary-text-color);
    font-size: 0.92rem;
}

.chat-scale__actions {
    display: flex;
    gap: 0.65rem;
}

.chat-scale__status {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.chat-scale__status.is-error {
    color: #b91c1c;
}

.chat-scale__result {
    border: 1px solid rgba(15, 76, 58, 0.1);
    border-radius: 14px;
    padding: 0.85rem 0.9rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(15, 76, 58, 0.04));
    box-shadow: 0 12px 28px -10px rgba(15, 178, 141, 0.2);
}

.chat-scale__result-title {
    font-weight: 700;
    color: var(--secondary-text-color);
}

.chat-scale__result-score {
    font-size: 0.96rem;
    color: var(--primary-text-color);
}

.hidden {
    display: none !important;
}

.genogram-panel {
    margin-top: 0.75rem;
    margin-bottom: 0.4rem;
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(15,178,141,0.18);
    box-shadow: 0 8px 22px rgba(0,0,0,0.03);
    font-size: 0.82rem;
}

.genogram-panel.hidden {
    display: none;
}

.genogram-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    margin-bottom: 0.35rem;
}

.genogram-risk-alert {
    margin: 0.25rem 0 0.55rem;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    background: linear-gradient(120deg, rgba(16,185,129,0.12), rgba(15,76,58,0.06));
    border: 1px solid rgba(16,185,129,0.2);
    color: var(--brand-primary);
    font-weight: 600;
    font-size: 0.82rem;
    box-shadow: var(--shadow-sm);
}

.genogram-canvas {
    position: relative;
    width: 100%;
    min-height: 140px;
    max-height: 260px;
    overflow: auto;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(248,253,252,0.9), #ffffff);
}

.genogram-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.genogram-nodes {
    position: relative;
    padding: 12px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.genogram-generation-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

.genogram-generation-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--muted-text);
    min-width: 80px;
}

.genogram-generation-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-start;
}

.family-block {
    position: relative;
    padding: 10px 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(15,178,141,0.16);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 6px 18px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 140px;
    align-items: center;
}

.family-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.family-parents-row,
.family-children-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    position: relative;
}

.family-children-row {
    padding-top: 4px;
}

.gen-node {
    position: relative;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.gen-node-shape {
    width: 26px;
    height: 26px;
    border: 2px solid rgba(15,178,141,0.9);
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.gen-node-shape.male {
    border-radius: 6px;
}

.gen-node-shape.female {
    border-radius: 50%;
}

.gen-node-shape.ego {
    box-shadow: 0 0 0 3px rgba(15,178,141,0.35);
}

.gen-node-deceased::after {
    content: "✝";
    position: absolute;
    top: -6px;
    right: -1px;
    font-size: 0.6rem;
    color: rgba(200, 70, 70, 0.9);
}

.gen-node-label {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    color: var(--muted-text);
    white-space: nowrap;
}

.gen-node-edit {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid rgba(15,178,141,0.28);
    background: rgba(255,255,255,0.92);
    color: var(--muted-text);
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.gen-node-edit:hover {
    color: var(--secondary-text-color);
    border-color: rgba(15,178,141,0.55);
}

.gen-node-risk .gen-node-shape {
    border: 2px solid rgba(16,185,129,0.65);
    box-shadow: 0 0 0 6px rgba(16,185,129,0.1), 0 10px 20px rgba(0,0,0,0.06);
}

.gen-node-risk-diabetes .gen-node-shape {
    border-color: #10B981;
    background: linear-gradient(145deg, rgba(16,185,129,0.18), rgba(15,76,58,0.08));
}

.gen-node-risk-cardio .gen-node-shape {
    border-color: #f87171;
    background: linear-gradient(145deg, rgba(248,113,113,0.16), rgba(248,113,113,0.06));
    box-shadow: 0 0 0 6px rgba(248,113,113,0.12);
}

.gen-node-risk-cancer .gen-node-shape {
    border-color: #a855f7;
    background: linear-gradient(145deg, rgba(168,85,247,0.16), rgba(168,85,247,0.05));
    box-shadow: 0 0 0 6px rgba(168,85,247,0.12);
}

.gen-node-risk-neuro .gen-node-shape {
    border-color: #38bdf8;
    background: linear-gradient(145deg, rgba(56,189,248,0.16), rgba(56,189,248,0.05));
    box-shadow: 0 0 0 6px rgba(56,189,248,0.12);
}

.genogram-empty {
    font-size: 0.82rem;
    color: var(--muted-text);
}

.genogram-sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
}

.genogram-toggle-icon svg {
    color: #e2f5f0;
}

.genogram-toggle-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.genogram-toggle-text span {
    color: #f8fafc;
    font-weight: 600;
}

.genogram-toggle-text small {
    color: var(--muted-text);
    font-size: 0.78rem;
}

.toggle-switch {
    position: relative;
    width: 42px;
    height: 22px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.25);
    transition: 0.3s;
    border-radius: 999px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: rgba(15,178,141,0.55);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Drawer de gráficos en chat */
.chart-drawer {
    position: fixed;
    inset: 0;
    z-index: 45;
    pointer-events: none;
}

.chart-drawer.open {
    pointer-events: auto;
}

.chart-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.18);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.chart-drawer.open .chart-drawer-overlay {
    opacity: 1;
}

.chart-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(420px, 92vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 1.4rem 1.4rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: -24px 0 48px rgba(0, 0, 0, 0.04), 0 20px 40px rgba(15, 76, 58, 0.1);
    backdrop-filter: blur(18px) saturate(180%);
    transform: translateX(24px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.chart-drawer.open .chart-drawer-panel {
    transform: translateX(0);
    opacity: 1;
}

.chart-drawer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(15, 76, 58, 0.06);
    border: 1px solid rgba(15, 76, 58, 0.12);
    color: var(--primary-text-color);
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chart-drawer-close:hover {
    box-shadow: 0 10px 30px -12px rgba(15, 76, 58, 0.2);
}

.chart-drawer-close:active {
    transform: scale(0.98);
}

.chart-drawer-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding-top: 0.3rem;
}

.chart-drawer-eyebrow {
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-text);
    margin-bottom: 0.15rem;
}

.chart-drawer-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--primary-text-color);
    margin: 0;
}

.chart-drawer-sub {
    margin: 0.1rem 0 0;
    color: var(--secondary-text-color);
    font-size: 0.95rem;
}

.chart-drawer-pill {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(15, 76, 58, 0.14));
    color: var(--primary-text-color);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 6px 20px -10px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
}

.chart-drawer-body {
    overflow: auto;
    padding-right: 0.15rem;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-drawer-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 243, 0.92));
    border-radius: 18px;
    padding: 1rem 1.05rem;
    border: 1px solid rgba(15, 76, 58, 0.08);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chart-drawer-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.chart-drawer-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--primary-text-color);
    margin: 0;
}

.chart-drawer-card-sub {
    margin: 0;
    color: var(--muted-text);
    font-size: 0.9rem;
}

.chart-drawer-frequency {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.chart-drawer-frequency-label {
    margin: 0;
    color: var(--secondary-text-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.chart-drawer-frequency-options {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.chart-drawer-chip {
    border: 1px solid rgba(15, 76, 58, 0.18);
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-text-color);
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-drawer-chip.active {
    background: linear-gradient(135deg, #0F4C3A, #10B981);
    color: #fff;
    box-shadow: 0 10px 24px -12px rgba(15, 76, 58, 0.35);
    border-color: transparent;
}

.chart-drawer-canvas-wrap {
    position: relative;
    width: 100%;
    height: 170px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 76, 58, 0.06);
    border-radius: 14px;
    padding: 0.5rem;
}

.chart-drawer-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
    flex-wrap: wrap;
}

.chart-drawer-status {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.chart-drawer .pill-button {
    min-height: 42px;
}

.chart-drawer .pill-button.ghost {
    background: rgba(15, 76, 58, 0.05);
}

  .chart-drawer .pill-ready {
      background: linear-gradient(135deg, #0F4C3A, #10B981);
      color: #fff;
  }

  /* ===== Drawer lateral para hábitos / gráficos sencillos ===== */
  .habit-drawer {
      position: fixed;
      inset: 0;
      z-index: 950;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.25s ease;
  }

  .habit-drawer.habit-drawer-open {
      pointer-events: auto;
      opacity: 1;
  }

  .habit-drawer-overlay {
      position: absolute;
      inset: 0;
      background: rgba(15, 23, 42, 0.45);
  }

  .habit-drawer-panel {
      position: absolute;
      top: 0;
      right: 0;
      height: 100%;
      width: min(480px, 100%);
      padding: 1.6rem 1.8rem 1.8rem;
      background: linear-gradient(180deg, #f6fbf8 0%, #ffffff 100%);
      box-shadow: -24px 0 45px rgba(15, 23, 42, 0.25);
      display: flex;
      flex-direction: column;
      gap: 1rem;
      transform: translateX(100%);
      transition: transform 0.28s ease;
      border-radius: 1.2rem 0 0 1.2rem;
  }

  .habit-drawer.habit-drawer-open .habit-drawer-panel {
      transform: translateX(0);
  }

  .habit-drawer-body {
      flex: 1;
      overflow-y: auto;
      padding-top: 0.5rem;
  }

  .habit-drawer-header {
      padding-right: 2.2rem;
  }

  .habit-drawer-tag {
      display: inline-flex;
      padding: 0.2rem 0.7rem;
      border-radius: 999px;
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      background: rgba(34, 197, 94, 0.12);
      color: #065f46;
  }

  .habit-drawer-title {
      margin: 0.4rem 0 0.2rem;
      font-size: 1.2rem;
      font-weight: 700;
      color: #111827;
  }

  .habit-drawer-subtitle {
      margin: 0;
      font-size: 0.9rem;
      color: #6b7280;
  }

  .habit-drawer-close {
      position: absolute;
      top: 14px;
      right: 18px;
      border: none;
      background: transparent;
      font-size: 1.4rem;
      line-height: 1;
      cursor: pointer;
      color: #9ca3af;
  }

  .habit-drawer-close:hover {
      color: #4b5563;
  }

  .habit-drawer-body .task-activation-card {
      margin: 0;
      width: 100%;
      max-width: 100%;
  }

  .habit-frequency {
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
      margin: 0.5rem 0 0;
  }

  .habit-frequency-label {
      margin: 0;
      color: var(--secondary-text-color);
      font-weight: 600;
      font-size: 0.92rem;
  }

  .habit-frequency-chips {
      display: flex;
      gap: 0.4rem;
      flex-wrap: wrap;
  }

  .habit-chip {
      border: 1px solid rgba(15, 76, 58, 0.18);
      background: rgba(255, 255, 255, 0.9);
      color: var(--primary-text-color);
      padding: 0.4rem 0.75rem;
      border-radius: 999px;
      font-weight: 600;
      font-size: 0.9rem;
      cursor: pointer;
      transition: all 0.2s ease;
  }

  .habit-chip.active {
      background: linear-gradient(135deg, #0F4C3A, #10B981);
      color: #fff;
      box-shadow: 0 10px 24px -12px rgba(15, 76, 58, 0.35);
      border-color: transparent;
  }

  @media (max-width: 768px) {
      .habit-drawer-panel {
          width: 100%;
          border-radius: 0;
      }
  }

  /* Diagnóstico asistente */
.assistant-dx-drawer {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
    z-index: 1200;
    transition: opacity 0.25s ease;
    opacity: 0;
}

.assistant-dx-drawer.open {
    pointer-events: auto;
    opacity: 1;
}

.assistant-dx-drawer.dragging .assistant-dx-sheet {
    transition: none;
}

.assistant-dx-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.24);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.assistant-dx-drawer.open .assistant-dx-overlay {
    opacity: 1;
}

.assistant-dx-sheet {
    position: relative;
    width: min(480px, 92vw);
    height: 100%;
    max-height: 100vh;
    overflow-y: auto;
    transform: translateX(calc(105% + var(--dx-drag-offset, 0px)));
    transition: transform 0.35s cubic-bezier(0.4, 0.14, 0.2, 1), opacity 0.35s ease;
    opacity: 0;
    margin: 0;
    border-radius: 0;
    border-left: 1px solid rgba(15, 76, 58, 0.08);
    box-shadow: -12px 0 40px -18px rgba(0, 0, 0, 0.18);
}

.assistant-dx-drawer.open .assistant-dx-sheet {
    transform: translateX(var(--dx-drag-offset, 0px));
    opacity: 1;
}

.assistant-dx {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(15, 76, 58, 0.08);
}

.assistant-dx__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.assistant-dx__label {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: var(--muted-text);
}

.assistant-dx__pill {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(15, 76, 58, 0.12));
    color: var(--brand-primary);
    font-weight: 700;
    font-size: 0.82rem;
    box-shadow: 0 10px 24px rgba(15, 76, 58, 0.16);
}

.assistant-dx__pill.pill-ready {
    background: linear-gradient(135deg, rgba(15, 76, 58, 0.22), rgba(16, 185, 129, 0.25));
    color: #0b3d2f;
}

.assistant-dx__body {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
    align-items: center;
}

.assistant-dx__main {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.assistant-dx__eyebrow {
    margin: 0;
    color: var(--muted-text);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.assistant-dx__title {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary-text-color);
    letter-spacing: -0.015em;
}

.assistant-dx__hint {
    margin: 0;
    color: var(--secondary-text-color);
    font-size: 0.92rem;
    line-height: 1.5;
}

.assistant-dx__scales {
    margin-top: 0.5rem;
    background: rgba(16, 185, 129, 0.08);
    color: var(--brand-primary);
    padding: 0.65rem 0.75rem;
    border-radius: 14px;
    border: 1px solid rgba(16, 185, 129, 0.16);
    font-weight: 600;
}

.assistant-dx__chart {
    position: relative;
    min-height: 160px;
}

.assistant-dx__chart canvas {
    width: 100% !important;
    height: 180px !important;
}

.assistant-dx__list {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.assistant-dx__drag {
    position: absolute;
    left: -14px;
    top: 14px;
    width: 12px;
    height: 64px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.35));
    box-shadow: -12px 0 24px -18px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 2;
}

.assistant-dx__drag:active {
    cursor: grabbing;
}

.assistant-dx__drag-bar {
    width: 4px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.55), rgba(15, 76, 58, 0.55));
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.assistant-dx__close {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(15, 76, 58, 0.08);
    border-radius: 999px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary-text-color);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    z-index: 2;
}

.assistant-dx__close:hover {
    transform: translateY(-1px);
    background: #fff;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.assistant-dx__close:active {
    transform: translateY(0);
}

.assistant-dx__item {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(15, 76, 58, 0.06);
    box-shadow: var(--shadow-sm);
}

.assistant-dx__item .label {
    display: block;
    font-weight: 700;
    color: var(--primary-text-color);
    margin-bottom: 0.15rem;
}

.assistant-dx__item .code {
    color: var(--muted-text);
    font-weight: 600;
    font-size: 0.9rem;
}

@media (max-width: 960px) {
    .assistant-dx__body {
        grid-template-columns: 1fr;
    }

    .assistant-dx__chart canvas {
        height: 140px !important;
    }
}

.quick-reply-card {
    margin-top: 14px;
    padding: 14px;
    border-radius: 16px;
    background: radial-gradient(circle at 20% 20%, rgba(16, 163, 127, 0.12), rgba(8, 47, 35, 0.05)), #ffffff;
    border: 1px solid rgba(16, 163, 127, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.quick-reply-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.quick-reply-title {
    font-weight: 700;
    color: var(--brand-primary);
    font-size: 0.95rem;
}

.quick-reply-sub {
    color: var(--muted-text);
    font-size: 0.85rem;
}

.quick-reply-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    animation: fadeIn 0.3s ease;
}

.quick-reply-chip {
    background: linear-gradient(135deg, rgba(16, 163, 127, 0.12), rgba(16, 163, 127, 0.02));
    border: 1px solid rgba(16, 163, 127, 0.3);
    color: #0f4c3a;
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 14px rgba(16, 163, 127, 0.08);
}

.quick-reply-chip:hover {
    background: linear-gradient(135deg, rgba(16, 163, 127, 0.2), rgba(16, 163, 127, 0.08));
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(16, 163, 127, 0.12);
}

.neural-event-bubble {
    margin-top: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(16, 163, 127, 0.12), rgba(16, 163, 127, 0.04));
    border: 1px dashed rgba(16, 163, 127, 0.35);
    border-radius: 12px;
    color: #0f4c3a;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.neural-event-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #10b981, #0b7a5d);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #e6fff6;
    box-shadow: 0 8px 18px rgba(16, 163, 127, 0.25);
}

.insight-card {
    margin-top: 12px;
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(19, 78, 74, 0.9), rgba(13, 148, 136, 0.8));
    color: #ecfeff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.insight-card h4 {
    margin: 0 0 8px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insight-card p {
    margin: 0 0 6px;
    font-size: 0.92rem;
}

.insight-card .insight-action {
    margin-top: 8px;
    font-weight: 600;
    color: #bbf7d0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.onboarding-tooltip {
    position: fixed;
    z-index: 10000;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(244, 250, 248, 0.96));
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(15, 163, 127, 0.18);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.16);
    padding: 18px 20px;
    max-width: 340px;
    animation: fadeInScale 0.3s ease;
}

.onboarding-content h4 {
    margin: 4px 0 6px;
    color: #0b3b2c;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.onboarding-content p {
    margin: 0 0 14px;
    color: #4a5568;
    font-size: 14px;
    line-height: 1.55;
}

.onboarding-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #0f4c3a;
    background: linear-gradient(120deg, rgba(16, 163, 127, 0.16), rgba(16, 163, 127, 0.08));
    border: 1px solid rgba(16, 163, 127, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.onboarding-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.onboarding-actions .pill-button {
    flex: 1;
    justify-content: center;
}

.onboarding-progress {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.onboarding-progress span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dbe5e0;
    transition: background 0.3s, transform 0.2s;
}

.onboarding-progress span.active {
    background: #10a37f;
    transform: scale(1.1);
}

.onboarding-highlight {
    position: relative;
    z-index: 9999;
    box-shadow: 0 0 0 4px rgba(16, 163, 127, 0.28), 0 0 0 99999px rgba(0, 0, 0, 0.42);
    border-radius: 10px;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- ESTADOS EMOCIONALES DEL ORBE (Conciencia Viva) --- */

/* Estado de Empatía (Cuando detecta dolor, miedo, ansiedad) */
.consciousness-orb.orb-empathetic .orb-aura {
    background: conic-gradient(from 0deg, #4f46e5, #9333ea, #4f46e5); /* Indigo a Violeta */
    animation-duration: 4s; 
    box-shadow: 0 0 25px rgba(79, 70, 229, 0.6); /* Glow fuerte */
    opacity: 0.8;
    filter: blur(6px);
}
.consciousness-orb.orb-empathetic .orb-core {
    position: absolute;
    inset: 8px;
    margin: auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #f4fffd 40%, #e0faf5 100%);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.95);
    z-index: 2;
    overflow: visible;
}

/* Estado de Celebración/Entusiasmo (Cuando detecta logros, alegría) */
.consciousness-orb.orb-excited .orb-aura {
    background: conic-gradient(from 0deg, #f59e0b, #ef4444, #eab308, #f59e0b); /* Fuego/Oro */
    animation-duration: 1.5s; 
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6); /* Glow dorado */
    opacity: 1;
    filter: blur(3px);
}
.consciousness-orb.orb-excited .orb-core {
    position: absolute;
    inset: 8px;
    margin: auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #f4fffd 40%, #e0faf5 100%);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.95);
    z-index: 2;
    overflow: visible;
}


/* ===== Panel y estados de la Orbe de Conciencia ===== */
.consciousness-orb.is-speaking .orb-aura {
    box-shadow: 0 0 35px rgba(96, 165, 250, 0.8);
    animation-duration: 1.6s;
    opacity: 1;
}

.consciousness-panel {
    position: fixed;
    bottom: 96px;
    right: 18px;
    width: 320px;
    max-width: calc(100% - 32px);
    background: rgba(15, 23, 42, 0.96);
    color: #f9fafb;
    border-radius: 18px;
    padding: 14px 16px 12px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.6);
    z-index: 40;
    border: 1px solid rgba(148, 163, 184, 0.45);
    backdrop-filter: blur(16px);
    font-size: 0.9rem;
}

.consciousness-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.consciousness-panel-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.consciousness-panel-badge {
    font-size: 0.78rem;
    opacity: 0.85;
}

.consciousness-panel-close {
    background: transparent;
    border: none;
    color: #e5e7eb;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.consciousness-panel-body {
    display: grid;
    gap: 6px;
    margin-bottom: 8px;
}

.consciousness-panel-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9ca3af;
}

.consciousness-panel-value {
    font-size: 0.86rem;
    color: #e5e7eb;
}

.consciousness-panel-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.consciousness-chip-btn {
    border-radius: 999px;
    border: 1px solid rgba(34, 197, 94, 0.45);
    padding: 4px 10px;
    font-size: 0.78rem;
    background: radial-gradient(circle at top left, rgba(16, 185, 129, 0.25), transparent);
    color: #d1fae5;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.consciousness-chip-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 18px rgba(16, 185, 129, 0.45);
    border-color: rgba(34, 197, 94, 0.9);
}

.consciousness-chip-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

@media (max-width: 768px) {
    .consciousness-panel {
        bottom: 86px;
        right: 12px;
        width: calc(100% - 24px);
    }
}


/* --- Neuro-simbolismo visual: ver pensar a la IA --- */
.neuro-visual {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: stretch;
}

.neuro-core {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    position: relative;
}

.neuro-node {
    position: relative;
    padding: 0.35rem 0.45rem;
    border-radius: 999px;
    background: radial-gradient(circle at 10% 0%, rgba(16,185,129,0.10), rgba(15,76,58,0.10));
    border: 1px solid rgba(16,185,129,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
}

.neuro-node-glow {
    position: absolute;
    inset: -40%;
    opacity: 0;
    background: radial-gradient(circle at 50% 50%, rgba(16,185,129,0.55), transparent 60%);
    filter: blur(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: scale(0.8);
}

.neuro-node-label {
    position: relative;
    z-index: 1;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--secondary-text-color);
}

.neuro-node.active .neuro-node-glow {
    opacity: 1;
    transform: scale(1);
    animation: neuroNodePulse 1.4s ease-in-out infinite;
}

.neuro-node-memory {
    --node-hue: 160;
}
.neuro-node-empathy {
    --node-hue: 320;
}
.neuro-node-medical {
    --node-hue: 200;
}

.neuro-node-memory.active .neuro-node-glow {
    background: radial-gradient(circle at 50% 50%, hsla(160, 84%, 45%, 0.65), transparent 60%);
}
.neuro-node-empathy.active .neuro-node-glow {
    background: radial-gradient(circle at 50% 50%, hsla(320, 84%, 60%, 0.60), transparent 60%);
}
.neuro-node-medical.active .neuro-node-glow {
    background: radial-gradient(circle at 50% 50%, hsla(200, 90%, 56%, 0.60), transparent 60%);
}

.neuro-caption {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    font-size: 0.72rem;
    opacity: 0.92;
}

.neuro-caption .thinking-label {
    font-weight: 500;
}

@keyframes neuroNodePulse {
    0% { transform: scale(0.96); opacity: 0.85; }
    50% { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(0.96); opacity: 0.85; }
}


/* --- Indicador de pensamiento: orbe neuro-simbólico --- */
.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
}

.thinking-orb {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 20%, rgba(255,255,255,0.9), transparent 55%),
        radial-gradient(
            circle at 80% 80%,
            hsla(var(--orb-main-hue, 160), var(--orb-main-sat, 80%), var(--orb-main-light, 55%), 0.50),
            hsla(var(--orb-main-hue, 160), var(--orb-main-sat, 80%), calc(var(--orb-main-light, 55%) - 8%), 0.95)
        );
    box-shadow:
        0 0 20px hsla(var(--orb-main-hue, 160), var(--orb-main-sat, 80%), var(--orb-main-light, 55%), 0.55),
        0 0 40px hsla(var(--orb-main-hue, 160), var(--orb-main-sat, 80%), calc(var(--orb-main-light, 55%) - 12%), 0.60),
        var(--shadow-sm);
    overflow: hidden;
    isolation: isolate;
    animation: thinkingOrbSpin var(--orb-breath-duration, 4s) linear infinite;
}

.thinking-orb-core {
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(5,40,32,0.95), rgba(0,0,0,0.9));
    box-shadow: inset 0 0 18px rgba(0,0,0,0.85);
}

.thinking-orb-ring {
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 1px dashed hsla(var(--orb-main-hue, 160), var(--orb-main-sat, 80%), 80%, 0.55);
    box-shadow: 0 0 12px hsla(var(--orb-main-hue, 160), var(--orb-main-sat, 80%), var(--orb-main-light, 55%), 0.60);
    animation: thinkingOrbPulse var(--orb-breath-duration, 4s) ease-in-out infinite;
}

.thinking-orb-node {
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #ffffff, #10B981);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.7), 0 0 12px rgba(16,185,129,0.85);
    transform-origin: 50% 50%;
    opacity: 0.75;
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

.orb-node-memory { top: 0%; left: 50%; transform: translate(-50%, -20%); }
.orb-node-empathy { top: 50%; left: 100%; transform: translate(-50%, -50%); }
.orb-node-medical { top: 100%; left: 50%; transform: translate(-50%, -80%); }

.thinking-orb-node::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: inherit;
    border: 1px solid rgba(255,255,255,0.18);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.thinking-orb-node.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.25);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.9),
        0 0 20px rgba(16,185,129,1);
}

.thinking-orb-node.active::after {
    opacity: 1;
}

.neuro-caption {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.78rem;
    max-width: 260px;
}

.neuro-caption .thinking-label {
    font-weight: 600;
}

.thinking-detail {
    font-weight: 400;
    opacity: 0.95;
}

/* Orbit/lighting animations */
@keyframes thinkingOrbSpin {
    0% { transform: rotate(0deg); filter: hue-rotate(0deg); }
    50% { transform: rotate(180deg); filter: hue-rotate(25deg); }
    100% { transform: rotate(360deg); filter: hue-rotate(0deg); }
}

@keyframes thinkingOrbPulse {
    0% { box-shadow: 0 0 12px rgba(16,185,129,0.25); opacity: 0.7; }
    50% { box-shadow: 0 0 24px rgba(16,185,129,0.65); opacity: 1; }
    100% { box-shadow: 0 0 12px rgba(16,185,129,0.25); opacity: 0.7; }
}


/* Vibración micro-fisiológica del layout cuando el arousal es muy alto */
@keyframes stressVibe {
    0%   { transform: translate3d(0, 0, 0); }
    25%  { transform: translate3d(0.4px, -0.4px, 0); }
    50%  { transform: translate3d(-0.5px, 0.5px, 0); }
    75%  { transform: translate3d(0.3px, 0.3px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

body.stress-mode-vibration .chat-main {
    animation: stressVibe 0.35s linear infinite;
}


/* Ajuste de anuncio cuando está en la barra lateral */
.sidebar .chat-ad-card {
    max-width: 100%;
    width: 100%;
    margin: 0.9rem 0 0.2rem;
    align-items: stretch;
}

.sidebar .chat-ad-card .ad-body {
    width: 100%;
}

.sidebar .chat-ad-card .ad-banner-shell {
    grid-template-columns: 1fr;
    align-items: flex-start;
}

.sidebar .chat-ad-card .ad-banner-shell::after {
    right: -30px;
    top: -30px;
    width: 90px;
    height: 90px;
    opacity: 0.5;
}



/* =====================================================
   PREMIUM CHAT AESTHETIC OVERRIDES - HEALTH-IA CHAT
   Fecha: 2025-12-04
   Nota: Estas reglas se aplican SOBRE el diseño base.
===================================================== */

:root {
    /* --- PALETA PREMIUM REFINADA --- */
    /* Fondos más cálidos y menos clínicos */
    --bg-color: #FCFCFB;
    --bg-gradient: radial-gradient(circle at top left, #F7FAF9 0%, #FDFEFE 50%, #F9FCFB 100%);
    --bg-color-alt: #F8FAF9;

    /* Sidebar: Glassmorphism más sutil */
    --sidebar-bg: rgba(255, 255, 255, 0.88);
    --sidebar-border: 1px solid rgba(236, 253, 245, 0.6);

    /* Textos con mejor contraste y legibilidad */
    --primary-text-color: #0F2419;
    --secondary-text-color: #2D4A3E;
    --muted-text: #6B8378;
    --border-color: rgba(15, 76, 58, 0.06);

    /* Verde bosque más suave y profesional */
    --brand-primary: #0E5945;
    --brand-secondary: #12B886;
    --brand-accent: #E6F7F0;
    --brand-light: #F0FAF6;

    /* Botones con gradientes más sutiles */
    --button-bg: linear-gradient(135deg, #0E5945 0%, #12B886 100%);
    --button-bg-hover: linear-gradient(135deg, #0C4A38 0%, #0FA676 100%);
    --button-text-color: #FFFFFF;

    /* Burbujas de chat más suaves */
    --user-message-bg: linear-gradient(135deg, #0E5945 0%, #12B886 100%);
    --user-text: #FFFFFF;
    --ai-message-bg: #FFFFFF;

    /* Sombras más orgánicas y sutiles */
    --shadow-xs: 0 1px 3px rgba(15, 76, 58, 0.03);
    --shadow-sm: 0 2px 6px rgba(15, 76, 58, 0.04);
    --shadow-md: 0 6px 16px rgba(15, 76, 58, 0.06);
    --shadow-lg: 0 12px 28px rgba(15, 76, 58, 0.08);
    --shadow-xl: 0 20px 40px rgba(15, 76, 58, 0.10);
    --shadow-glow: 0 0 24px rgba(18, 184, 134, 0.15);
    
    /* Sombra especial para anuncios - más premium */
    --shadow-ad: 0 8px 24px rgba(15, 76, 58, 0.08), 
                 0 2px 8px rgba(15, 76, 58, 0.04),
                 inset 0 1px 0 rgba(255, 255, 255, 0.5);

    /* Extras mejorados */
    --glass: rgba(255, 255, 255, 0.82);
    --shadow-inner: inset 0 1px 0 rgba(255,255,255,0.85);
    
    /* Colores de estado más sutiles */
    --success-color: #12B886;
    --success-light: #E6F7F0;
    --warning-color: #F59E0B;
    --warning-light: #FEF3E2;
    --error-color: #EF4444;
    --error-light: #FEE2E2;
}

html, body {
    background: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--primary-text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    animation: fadeIn 0.8s ease-out;
    line-height: 1.6;
}

h1, h2, h3, .sidebar-title, .brand-title {
    letter-spacing: -0.025em;
    color: var(--primary-text-color);
    font-weight: 700;
}

/* ========================================
   CONTENEDOR PRINCIPAL
======================================== */

.chat-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    background: transparent;
    align-items: start;
    gap: 0;
}

.chat-container.sidebar-collapsed {
    grid-template-columns: 90px 1fr;
}

/* ========================================
   SIDEBAR - Más elegante y espaciosa
======================================== */

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-radius: 0 28px 28px 0;
    box-shadow: 
        20px 0 40px rgba(0,0,0,0.02),
        0 0 0 1px rgba(236, 253, 245, 0.5);
    padding: 1.5rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-right: 1px solid rgba(236, 253, 245, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 1.1rem;
    background: var(--brand-light);
    border-radius: 16px;
    box-shadow: var(--shadow-xs);
    border: 1px solid rgba(18, 184, 134, 0.08);
    flex: 1;
    min-width: 0;
    position: relative;
    transition: all 0.3s ease;
}

.brand-mark:hover {
    box-shadow: var(--shadow-sm);
    background: #FFFFFF;
}

.sidebar-header .logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(145deg, #12B886 0%, #0E5945 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.5),
        0 8px 20px rgba(18, 184, 134, 0.25);
    position: relative;
    overflow: hidden;
}

.logo-stetho::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 11px;
    background: radial-gradient(circle at 25% 25%, rgba(255,255,255,0.35), transparent 55%);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

/* Menú lateral más espaciado */
.sidebar-menu li a,
#new-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1.1rem;
    text-decoration: none;
    color: var(--secondary-text-color);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-menu li a:hover,
#new-chat-btn:hover {
    background: var(--brand-light);
    color: var(--brand-primary);
    border-color: rgba(18, 184, 134, 0.12);
    transform: translateX(2px);
    text-decoration: none;
}

.sidebar-menu li a svg,
#new-chat-btn svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    flex-shrink: 0;
    color: var(--secondary-text-color);
    opacity: 0.9;
    transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
}

.sidebar-menu li a:hover .sidebar-icon,
.sidebar-menu li a:focus-visible .sidebar-icon {
    color: var(--brand-primary);
    opacity: 1;
    transform: translateX(1px);
}

/* ========================================
   GLASS PANELS - Más sutiles y elegantes
======================================== */

.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: var(--shadow-md);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.glass-panel:hover {
    box-shadow: var(--shadow-lg);
}

/* ========================================
   CHAT SHELL - Más amplio y respirable
======================================== */

.chat-shell {
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem 0.75rem;
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.98), 
        rgba(248,252,250,0.96));
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 
        var(--shadow-inner), 
        0 6px 20px rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
}

/* ========================================
   MENSAJES - Más elegantes y espaciados
======================================== */

.message {
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    max-width: 75%;
    line-height: 1.7;
    word-wrap: break-word;
    animation: slideUpFade 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin-bottom: 1.75rem;
    font-size: 1rem;
    letter-spacing: 0.01em;
    border: none;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.message:hover {
    transform: translateY(-1px);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-message {
    background: var(--user-message-bg);
    color: var(--user-text);
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 
        var(--shadow-glow),
        0 8px 20px rgba(18, 184, 134, 0.20);
    margin-left: 2.5rem;
    font-weight: 500;
}

.ai-message {
    background-color: var(--ai-message-bg);
    color: var(--secondary-text-color);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    box-shadow: var(--shadow-md);
    margin-right: 2.5rem;
    border: 1px solid rgba(0,0,0,0.02);
}

/* ========================================
   ANUNCIOS - Diseño Premium Integrado
======================================== */

.chat-ad-card {
    margin: 1rem auto 1.5rem;
    padding: 0;
    border-radius: 20px;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 1020px;
    width: min(98%, 1020px);
    align-items: center;
}

.chat-ad-card .ad-label {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-text);
    font-weight: 700;
    width: 100%;
    padding: 0 0.5rem;
    opacity: 0.7;
}

.chat-ad-card .ad-body {
    background: transparent;
    border-radius: 20px;
    padding: 0;
    width: 100%;
}

.ad-banner-shell {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: 20px;
    background: 
        radial-gradient(circle at 5% 10%, rgba(18, 184, 134, 0.08), transparent 40%),
        linear-gradient(135deg, #FFFFFF 0%, #F7FAF9 100%);
    border: 1px solid rgba(18, 184, 134, 0.12);
    box-shadow: var(--shadow-ad);
    position: relative;
    overflow: hidden;
    min-height: 90px;
    transition: all 0.3s ease;
}

.ad-banner-shell:hover {
    box-shadow: 
        0 12px 32px rgba(15, 76, 58, 0.10),
        0 4px 12px rgba(15, 76, 58, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.ad-banner-shell::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.5s ease;
}

.ad-banner-shell:hover::before {
    left: 100%;
}

.ad-banner-shell::after {
    content: '';
    position: absolute;
    right: -25px;
    top: -25px;
    width: 140px;
    height: 140px;
    background: radial-gradient(
        circle at center, 
        rgba(18, 184, 134, 0.12), 
        transparent 65%
    );
    pointer-events: none;
}

.ad-banner-headline {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--primary-text-color);
    z-index: 1;
    position: relative;
}

.ad-eyebrow {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-secondary);
    opacity: 0.9;
}

.ad-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-text-color);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.ad-subtitle {
    margin: 0;
    font-size: 0.92rem;
    color: var(--secondary-text-color);
    line-height: 1.5;
    opacity: 0.9;
}

.ad-cta {
    border: none;
    background: linear-gradient(135deg, #0E5945 0%, #12B886 100%);
    color: #FFFFFF;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 
        0 8px 20px rgba(18, 184, 134, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    z-index: 1;
    position: relative;
}

.ad-cta:hover,
.ad-cta:focus-visible {
    transform: translateY(-3px);
    box-shadow: 
        0 12px 28px rgba(18, 184, 134, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    background: linear-gradient(135deg, #0C4A38 0%, #0FA676 100%);
}

.ad-cta:active {
    transform: translateY(-1px);
}

.ad-slot {
    margin-top: 0.75rem;
    width: 100%;
    display: block;
    position: relative;
    min-height: 90px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(248, 252, 250, 0.5);
    border: 1px solid rgba(18, 184, 134, 0.06);
}

.ad-slot ins.adsbygoogle {
    display: block;
    width: 100%;
    min-height: 90px;
    border-radius: 16px;
}

/* ========================================
   BANNER SUPERIOR/INFERIOR
======================================== */

.ad-top, .ad-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin: 0.75rem 0;
}

.ad-top {
    min-height: 60px;
    max-width: 900px;
    width: 100%;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.ad-bottom {
    min-height: 60px;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

/* ========================================
   SAFETY BANNER - Más sutil
======================================== */

.safety-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-left: 3px solid rgba(239, 68, 68, 0.4);
    background: linear-gradient(120deg, 
        rgba(254, 242, 242, 0.8), 
        rgba(255, 255, 255, 0.9));
    color: var(--primary-text-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.safety-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.safety-copy {
    font-size: 0.95rem;
    color: var(--secondary-text-color);
    line-height: 1.6;
}

/* ========================================
   INPUT - Más elegante y espacioso
======================================== */

.chat-input-wrapper {
    pointer-events: auto;
    display: flex;
    align-items: flex-end;
    max-width: 48rem;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(18, 184, 134, 0.15);
    box-shadow: 
        0 16px 40px rgba(15, 76, 58, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    padding: 0.85rem 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-input-wrapper:focus-within {
    transform: translateY(-4px);
    box-shadow: 
        0 20px 50px rgba(15, 76, 58, 0.12),
        0 0 0 3px rgba(18, 184, 134, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border-color: var(--brand-secondary);
}

#chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 1.05rem;
    padding: 0.5rem 1rem;
    background: transparent;
    max-height: 200px;
    min-height: 28px;
    line-height: 1.6;
    font-family: inherit;
    color: var(--primary-text-color);
}

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

#send-btn {
    background: linear-gradient(135deg, #0E5945 0%, #12B886 100%);
    color: var(--button-text-color);
    border-radius: 16px;
    width: 42px;
    height: 42px;
    margin-left: 0.5rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 20px rgba(18, 184, 134, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0C4A38 0%, #0FA676 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 12px 28px rgba(18, 184, 134, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

#send-btn:active:not(:disabled) {
    transform: translateY(0) scale(1);
}

#send-btn:disabled {
    background: linear-gradient(135deg, #D1D5DB 0%, #9CA3AF 100%);
    cursor: not-allowed;
    transform: scale(1);
    box-shadow: none;
}

/* ========================================
   THINKING INDICATOR - Más elegante
======================================== */

.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #4b5563;
    background: #f7f7f8;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 20px -18px rgba(0, 0, 0, 0.35), var(--shadow-sm);
    border-radius: 14px;
    padding: 0.45rem 0.85rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.thinking-indicator::before {
    display: none;
}

.thinking-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    box-shadow: none;
    animation: thinkingPulse 0.9s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinkingPulse {
    0%, 100% { 
        transform: translateY(0); 
        opacity: 0.5;
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
    }
    50% { 
        transform: translateY(-4px); 
        opacity: 1;
        box-shadow: 0 4px 12px rgba(18, 184, 134, 0.4);
    }
}

/* ========================================
   CHIPS Y BOTONES - Más refinados
======================================== */

.chip {
    border: 1px solid rgba(18, 184, 134, 0.25);
    background: rgba(255, 255, 255, 0.95);
    color: var(--secondary-text-color);
    border-radius: 12px;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.chip:hover {
    background: var(--brand-light);
    border-color: rgba(18, 184, 134, 0.4);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.chip.mode-chip.active-mode {
    background: linear-gradient(135deg, #0E5945, #12B886);
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: 
        0 8px 20px rgba(18, 184, 134, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.pill-button {
    border: 1px solid rgba(18, 184, 134, 0.25);
    background: linear-gradient(135deg, 
        rgba(230, 247, 240, 0.8), 
        rgba(18, 184, 134, 0.08));
    color: var(--brand-primary);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xs);
}

.pill-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, #0E5945, #12B886);
    color: #FFFFFF;
    border-color: transparent;
}

/* ========================================
   RESPONSIVE SUAVE PARA ANUNCIOS
======================================== */

@media (max-width: 1024px) {
    .chat-ad-card {
        max-width: 100%;
        width: 100%;
    }
    
    .ad-banner-shell {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem 1.25rem;
    }
}



/* === Ajustes extra: sidebar colapsado y selector de modo === */
.sidebar.collapsed #user-info,
.sidebar.collapsed .sidebar-user {
    justify-content: center;
}

.sidebar.collapsed .sidebar-user-name {
    display: none;
}

.sidebar-emoji-icon {
    font-size: 1.05rem;
}

/* Selector de modo tipo ChatGPT */
.quick-actions.compact {
    background: transparent;
    border: none;
    padding: 0;
}

.mode-selector-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.mode-select-wrapper {
    position: relative;
}

.mode-select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 999px;
    border: 1px solid rgba(15, 178, 141, 0.35);
    background: rgba(255, 255, 255, 0.98);
    padding: 0.3rem 1.9rem 0.3rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary-text-color);
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 178, 141, 0.08);
}

.mode-select-wrapper::after {
    content: "▾";
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--muted-text);
    pointer-events: none;
}

.selector-caption {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted-text);
}


/* =========================================================
   FINAL CHAT LAYOUT 2025-12-04
   - Burbujas tipo ChatGPT centradas
   - Área del chat con scroll propio
   - Input fijo abajo sin tapar el último mensaje
========================================================= */

.chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
}

.chat-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Contenedor principal de mensajes */
.chat-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* el scroll vive en .chat-messages */
}

/* Columna central de mensajes con scroll propio */
.chat-messages {
    flex: 1;
    width: 100%;
    max-width: 52rem; /* más ancho, tipo ChatGPT */
    margin: 0 auto;
    padding: 1.25rem 1.75rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;

    /* Espacio de seguridad para que el último bubble no quede debajo del input */
    padding-bottom: 180px;
}

.chat-messages::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Burbujas de mensajes */
.message {
    max-width: 88%;
    margin-bottom: 0; /* el espacio lo da gap en .chat-messages */
    line-height: 1.7;

    /* FIX: evita que textos largos (JSON, URLs, tokens sin espacios) se salgan del bubble
       cuando el contenedor padre tiene overflow-x:hidden */
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Contenido potencialmente ancho dentro de bubbles */
.message pre,
.message code,
.message table {
    max-width: 100%;
}

.message pre {
    overflow-x: auto;
}

.message table {
    display: block;
    overflow-x: auto;
}


.user-message {
    align-self: flex-end;
    margin-left: 2.5rem;
}

.ai-message {
    align-self: flex-start;
    margin-right: 2.5rem;
}

/* Input fijo en la parte inferior, tipo ChatGPT */
.chat-input-area {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 25;
    margin-top: 0; /* sobreescribe margin-top: auto previo */
    padding: 0.85rem 1.75rem 1.5rem;
    background: linear-gradient(
        to top,
        rgba(253, 253, 251, 0.98) 0%,
        rgba(253, 253, 251, 0.96) 60%,
        rgba(253, 253, 251, 0.88) 80%,
        rgba(253, 253, 251, 0.0) 100%
    );
    pointer-events: none;
}

.chat-input-wrapper {
    pointer-events: auto;
    max-width: 52rem;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
}

/* Responsive: el chat ocupa todo el ancho en móvil */
@media (max-width: 768px) {
    .chat-messages {
        max-width: 100%;
        padding: 1rem 1rem 1.5rem;
        padding-bottom: 200px;
    }

    .chat-input-wrapper {
        max-width: 100%;
    }

    .message {
        max-width: 94%;
        margin-left: 0;
        margin-right: 0;
    }
}

@media (max-width: 560px) {
    .chat-messages {
        padding: 0.75rem 0.75rem 1.25rem;
        padding-bottom: 220px;
    }

    .message {
        max-width: 96%;
        padding: 1rem 1.25rem;
    }
}


/* === FIX LAYOUT CHAT: burbujas alineadas con toolbar + input grande tipo ChatGPT === */

/* Toda la shell del chat es un solo panel coherente */
.chat-shell {
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(244,255,251,0.97));
    border: 1px solid rgba(15, 178, 141, 0.08);
    box-shadow: var(--shadow-inner), 0 10px 28px rgba(0,0,0,0.05);
}

/* El área de mensajes ya no es un segundo card separado */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.9rem 0.75rem 0.2rem;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Columna de mensajes ancha, pegada a la izquierda bajo "Sesión en curso" */
.chat-messages {
    max-width: 100%;
    margin: 0;
    padding: 0.4rem 0.75rem 1.75rem;
}

/* Input de chat a lo ancho del panel */
.chat-input-area {
    background: transparent;
    padding: 0 0.75rem 1.1rem;
    position: sticky;
    bottom: 0;
    z-index: 20;
    pointer-events: none;
    margin-top: auto;
}

.chat-input-wrapper {
    pointer-events: auto;
    display: flex;
    align-items: flex-end;
    max-width: 100%;
    width: 100%;
    margin: 0;
}

/* Altura mínima más cómoda para el textarea */
#chat-input {
    min-height: 52px;
}



/* Tarjeta de feedback de humanidad de la IA */
.feedback-message {
    max-width: 80%;
}

.feedback-card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    padding: 0.9rem 1rem;
    box-shadow: 0 10px 30px rgba(15, 40, 32, 0.12);
    border: 1px solid rgba(15, 76, 58, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feedback-text {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.feedback-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.feedback-btn {
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
    border: 1px solid rgba(15, 76, 58, 0.18);
    background: rgba(240, 253, 250, 0.9);
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.feedback-btn-yes {
    background: linear-gradient(135deg, #0F4C3A, #0F766E);
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: 0 10px 25px rgba(15, 118, 110, 0.35);
}

.feedback-btn-no {
    background: rgba(249, 250, 251, 0.96);
    color: var(--secondary-text-color);
}

.feedback-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(15, 76, 58, 0.22);
}

.feedback-card-answered .feedback-btn {
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
}

.feedback-card-answered .feedback-text::after {
    content: ' · Gracias, esto me ayuda a ser más humana contigo.';
    font-weight: 500;
}



/* --- ZORRITO MÉDICO FLOTANTE (REEMPLAZO VISUAL DEL ORBE) --- */

.consciousness-orb {
    width: 80px;
    height: 80px;
    position: relative;
    display: block;
    margin-left: 12px;
    flex-shrink: 0;
    z-index: 10;

    /* Orbe base: cápsula luminosa para el gatito médico */
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #e0f7f2 45%, #b3ece2 100%);
    border: 2px solid rgba(79, 209, 197, 0.32);
    box-shadow:
        0 0 18px rgba(79, 209, 197, 0.45),
        0 0 36px rgba(79, 209, 197, 0.25),
        inset 0 0 12px rgba(0, 0, 0, 0.16);

    animation: pulse 4s ease-in-out infinite;
    transition: all 0.5s ease;
}

.orb-core {
    position: absolute;
    inset: 8px;
    margin: auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #f4fffd 40%, #e0faf5 100%);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.95);
    z-index: 2;
    overflow: visible;
}

.orb-aura {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    opacity: 0.55;
    filter: blur(8px);
    background:
        radial-gradient(circle at 30% 0%, rgba(16, 185, 129, 0.18), transparent 65%),
        radial-gradient(circle at 70% 100%, rgba(56, 189, 248, 0.18), transparent 60%);
    animation: floatDrift 10s ease-in-out infinite;
    pointer-events: none;
}

/* Avatar base */
.fox-avatar {
    position: relative;
    width: 34px;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* Orejas del gatito */
.fox-ears {
    position: absolute;
    top: -6px;
    left: 3px;
    right: 3px;
    height: 12px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.fox-ear {
    width: 11px;
    height: 13px;
    background: #faccaa;
    border-radius: 8px 8px 0 0;
    transform-origin: bottom center;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
    position: relative;
    overflow: hidden;
}

.fox-ear::after {
    content: '';
    position: absolute;
    inset: 3px 3px 4px;
    border-radius: inherit;
    background: #fed7aa;
}

.fox-ear.ear-left {
    transform: rotate(-10deg);
}

.fox-ear.ear-right {
    transform: rotate(8deg);
}

/* Cabeza del gatito */
.fox-head {
    position: relative;
    margin-top: 4px;
    width: 28px;
    height: 22px;
    background: #fee2c5;
    border-radius: 13px 13px 11px 11px;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.16);
    overflow: hidden;
}

.fox-face {
    position: absolute;
    inset: 4px 3px 5px 3px;
    background: linear-gradient(180deg, #fed7aa 0%, #fed0a4 55%, #fee2c5 100%);
    border-radius: 11px;
}

/* Hocico y mejillas claras */
.fox-muzzle {
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 13px;
    height: 8px;
    background: #fff7ed;
    border-radius: 10px;
    transform: translateX(-50%);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.fox-muzzle::before,
.fox-muzzle::after {
    content: '';
    position: absolute;
    top: -2px;
    width: 8px;
    height: 6px;
    background: #fff7ed;
    border-radius: 50%;
}

.fox-muzzle::before {
    left: -5px;
}

.fox-muzzle::after {
    right: -5px;
}

/* Nariz */
.fox-muzzle::marker {}

.fox-face::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    width: 5px;
    height: 3px;
    border-radius: 50%;
    background: #1f2933;
    transform: translateX(-50%);
}

/* Ojos del gatito */
.fox-eye {
    position: absolute;
    top: 7px;
    width: 4px;
    height: 7px;
    background: #111827;
    border-radius: 999px;
}

.fox-eye.eye-left {
    left: 7px;
}

.fox-eye.eye-right {
    right: 7px;
}

/* Parpadeo natural del gatito */
@keyframes blink {
    0%, 92%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

.fox-eye {
    animation: blink 4s infinite ease-in-out;
    transform-origin: center;
}

.fox-eye.eye-right {
    animation-delay: 0.12s;
}

/* Cuerpo con bata médica */
.fox-body {
    position: absolute;
    bottom: -14px;
    left: 50%;
    width: 22px;
    height: 22px;
    transform: translateX(-50%);
}

.fox-coat {
    position: absolute;
    inset: 0;
    border-radius: 10px 10px 12px 12px;
    background: linear-gradient(180deg, #f9fafb 0%, #e5f3ff 100%);
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.22);
}

.fox-coat::before,
.fox-coat::after {
    content: '';
    position: absolute;
    top: 5px;
    width: 7px;
    height: 14px;
    background: rgba(148, 163, 184, 0.18);
    border-radius: 10px;
}

.fox-coat::before {
    left: 2px;
}

.fox-coat::after {
    right: 2px;
}

/* Estetoscopio minimal */
.fox-stetho {
    position: absolute;
    top: 1px;
    left: 50%;
    width: 18px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid rgba(37, 99, 235, 0.7);
    border-top-color: transparent;
    transform: translateX(-50%);
}

.fox-stetho::before,
.fox-stetho::after {
    content: '';
    position: absolute;
    bottom: -1px;
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.85);
}

.fox-stetho::before {
    left: -1px;
}

.fox-stetho::after {
    right: -1px;
}

/* Props opcionales (taza / escoba) muy sutiles */
.fox-props {
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
}

.fox-prop {
    width: 6px;
    height: 8px;
    border-radius: 2px;
    opacity: 0.65;
}

.fox-prop-mug {
    background: #c4f1f9;
}

.fox-prop-broom {
    background: #fbbf77;
}
/* Fin gatito médico */
.orb-core {
    position: absolute;
    inset: 8px;
    margin: auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #f4fffd 40%, #e0faf5 100%);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.95);
    z-index: 2;
    overflow: visible;
}

/* Gatito estructural */
.fox-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    transform-origin: center bottom;
    animation: catFloat 4.5s ease-in-out infinite;
}

@keyframes catFloat {
    0%, 100% { transform: translateY(1px); }
    50% { transform: translateY(-3px); }
}

.fox-ears {
    position: absolute;
    top: -4px;
    left: 4px;
    right: 4px;
    height: 12px;
}

.fox-ear {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fed7aa;
    border-radius: 60% 60% 0 0;
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

.fox-ear::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: inherit;
    background: #f97316;
}

.fox-ear.ear-left {
    left: 0;
    transform: rotate(-8deg);
}

.fox-ear.ear-right {
    right: 0;
    transform: rotate(8deg);
}

.fox-head {
    position: absolute;
    top: 2px;
    left: 3px;
    right: 3px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(145deg, #fed7aa, #fde68a);
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.fox-face {
    position: absolute;
    inset: 3px 4px 4px;
    border-radius: 999px;
    background: #fefce8;
}

.fox-eye {
    position: absolute;
    top: 7px;
    width: 4px;
    height: 7px;
    border-radius: 999px;
    background: #111827;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.15);
}

.fox-eye::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
}

.fox-eye.eye-left {
    left: 7px;
}

.fox-eye.eye-right {
    right: 7px;
}

.fox-muzzle {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 8px;
    border-radius: 999px;
    background: #fee2e2;
}

.fox-body {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 18px;
    border-radius: 12px 12px 14px 14px;
    background: linear-gradient(145deg, #ecfeff, #e0f2fe);
    box-shadow: 0 2px 4px rgba(15,23,42,0.18);
}

.fox-coat {
    position: absolute;
    inset: 3px 4px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.fox-stetho {
    position: absolute;
    top: 2px;
    left: 6px;
    right: 6px;
    height: 10px;
    border-radius: 999px;
    border: 2px solid rgba(209,250,229,0.9);
    box-sizing: border-box;
}

.fox-stetho::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ecfdf5;
    box-shadow: 0 0 0 1px rgba(15,23,42,0.12);
}

.fox-props {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 14px;
}

/* Taza de café */
.fox-prop-mug {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 11px;
    height: 9px;
    border-radius: 4px;
    background: #f9fafb;
    box-shadow: 0 1px 2px rgba(15,23,42,0.25);
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.fox-prop-mug::before {
    content: '';
    position: absolute;
    right: -4px;
    top: 2px;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    border: 2px solid #e5e7eb;
}

.fox-prop-mug::after {
    content: '';
    position: absolute;
    top: -3px;
    left: 2px;
    width: 7px;
    height: 2px;
    border-radius: 999px;
    background: #b45309;
}

/* Escoba */
.fox-prop-broom {
    position: absolute;
    right: 2px;
    bottom: 0;
    width: 12px;
    height: 10px;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.fox-prop-broom::before {
    content: '';
    position: absolute;
    left: 4px;
    bottom: 2px;
    width: 2px;
    height: 10px;
    border-radius: 999px;
    background: #92400e;
}

.fox-prop-broom::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 10px;
    height: 6px;
    border-radius: 0 0 6px 6px;
    background: #facc15;
}

/* Estados del avatar */
.activity-coffee .fox-prop-mug {
    opacity: 1;
    transform: translateY(0);
}

.activity-cleaning .fox-prop-broom {
    opacity: 1;
    transform: translateY(0);
}

.activity-sleep .fox-head {
    transform: translateY(1px);
}

.activity-alert .consciousness-orb {
    width: 80px;
    height: 80px;
    position: relative;
    display: block;
    margin-left: 12px;
    flex-shrink: 0;
    z-index: 10;

    /* Orbe base: cápsula luminosa para el gatito médico */
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #ffffff 0%, #e0f7f2 45%, #b3ece2 100%);
    border: 2px solid rgba(79, 209, 197, 0.32);
    box-shadow:
        0 0 18px rgba(79, 209, 197, 0.45),
        0 0 36px rgba(79, 209, 197, 0.25),
        inset 0 0 12px rgba(0, 0, 0, 0.16);

    animation: pulse 4s ease-in-out infinite;
    transition: all 0.5s ease;
}

.activity-thinking .fox-avatar {
    animation: catThinking 3.5s ease-in-out infinite;
}

@keyframes catThinking {
    0%, 100% { transform: translateY(1px) rotate(0deg); }
    30% { transform: translateY(-2px) rotate(-3deg); }
    60% { transform: translateY(-2px) rotate(3deg); }
}

/* Animaciones de latido suave del orbe */
@keyframes pulse {
    0% {
        box-shadow: 0 0 15px rgba(79, 209, 197, 0.4), 0 0 30px rgba(79, 209, 197, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(79, 209, 197, 0.6), 0 0 50px rgba(79, 209, 197, 0.3);
        transform: scale(1.03);
    }
    100% {
        box-shadow: 0 0 15px rgba(79, 209, 197, 0.4), 0 0 30px rgba(79, 209, 197, 0.2);
        transform: scale(1);
    }
}

.consciousness-orb.thinking {
    animation: pulse-fast 1.5s ease-in-out infinite;
    box-shadow:
        0 0 20px rgba(100, 180, 255, 0.5),
        0 0 40px rgba(100, 180, 255, 0.3);
}

@keyframes pulse-fast {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.97); opacity: 0.8; }
}

/* Ocultamos el avatar vectorial anterior para que no interfiera con el zorro */

/* =========================================================
   HERO INICIAL TIPO CHATGPT
   - Mensaje central "¿En qué puedo ayudar, Arisnachy?"
   - Tarjeta de prompt similar a la home de ChatGPT
   - No interfiere con el área de mensajes ni con los banners laterales
   ========================================================= */

.welcome-message {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.75rem 1rem 1.5rem;
}

.welcome-inner {
    max-width: 42rem;
    margin: 0 auto;
    text-align: center;
}

.welcome-inner h2 {
    margin: 0 0 2.25rem;
    font-size: clamp(2.1rem, 2.7vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: #111827;
}

.welcome-card {
    display: flex;
    justify-content: center;
}

.welcome-card-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    max-width: 32rem;
    padding: 0.85rem 1.15rem;
    border-radius: 999px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    box-shadow: 0 14px 35px -18px rgba(15, 23, 42, 0.55);
}

.welcome-card-left {
    display: flex;
    flex-direction: column;
    text-align: left;
    min-width: 0;
}

.welcome-card-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 0.2rem;
}

.welcome-card-placeholder {
    font-size: 0.98rem;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.welcome-card-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.welcome-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.32rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(16, 163, 127, 0.3);
    background: #ffffff;
    color: #111827;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: default;
}

.welcome-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #10a37f;
    box-shadow: 0 0 0 4px rgba(16, 163, 127, 0.2);
}

.welcome-chip-text {
    line-height: 1;
}

/* Responsive: centrar y ajustar en pantallas pequeñas */
@media (max-width: 768px) {
    .welcome-message {
        padding: 2rem 1rem 1rem;
    }
    .welcome-card-shell {
        max-width: 100%;
        padding-inline: 0.9rem;
    }
    .welcome-card-placeholder {
        font-size: 0.95rem;
    }
}

/* Cuando hay mensajes, el JS ya se encarga de ocultar .welcome-message */

/* =========================
   Gatito SVG dentro del Orbe
   ========================= */

.floating-orb .consciousness-orb .cat-svg {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
    transition: transform 0.3s ease;
}

/* Estado base: ojos normales y boca feliz visibles */
.consciousness-orb #normalEyes,
.consciousness-orb #happyMouth {
    display: block;
}

.consciousness-orb #sleepyEyes,
.consciousness-orb #loveEyes,
.consciousness-orb #sadEyes,
.consciousness-orb #sadMouth {
    display: none;
}

/* Caras según estado emocional del orbe */
.consciousness-orb.orb-happy #normalEyes {
    display: none;
}
.consciousness-orb.orb-happy #loveEyes {
    display: block;
}

.consciousness-orb.orb-sad #normalEyes,
.consciousness-orb.orb-sad #happyMouth {
    display: none;
}
.consciousness-orb.orb-sad #sadEyes,
.consciousness-orb.orb-sad #sadMouth {
    display: block;
}

.consciousness-orb.orb-sleepy #normalEyes {
    display: none;
}
.consciousness-orb.orb-sleepy #sleepyEyes {
    display: block;
}

/* Accesorios según actividad detectada */
.consciousness-orb .accessory {
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    transform-origin: center;
}


.consciousness-orb.activity-coffee .coffee-cup {
    opacity: 1;
    transform: translate(6px, -4px) scale(1.7);
    transform-origin: center;
}


.consciousness-orb.activity-cleaning .broom {
    opacity: 1;
    transform: translate(-4px, -4px) scale(1.7);
    transform-origin: center;
}


.consciousness-orb.orb-sleepy .zzz {
    opacity: 1;
    transform: translate(4px, -8px) scale(1.6);
    transform-origin: center;
}


/* Animaciones suaves del gatito según estado del orbe */
.consciousness-orb.orb-happy .cat-svg {
    animation: kittyHappyBounce 0.7s ease-in-out infinite;
}

.consciousness-orb.orb-sleepy .cat-svg {
    animation: kittySleepingBreath 3s ease-in-out infinite;
}

.consciousness-orb.orb-sad .cat-svg {
    animation: kittySadSway 2.4s ease-in-out infinite;
}

.consciousness-orb.activity-thinking .cat-svg {
    animation: kittyThinkingTilt 2.2s ease-in-out infinite;
}

@keyframes kittyHappyBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.04); }
}

@keyframes kittySleepingBreath {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(0.97) translateY(2px); }
}

@keyframes kittySadSway {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes kittyThinkingTilt {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-4deg); }
    75% { transform: rotate(4deg); }
}

/* ========================================
   OPTIMIZACIONES DE RENDIMIENTO (INPUT)
======================================== */

/* Blur y sombras más ligeras en la barra lateral */
.sidebar {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(236, 253, 245, 0.45);
    contain: layout style;
}

/* Contención y aceleración para el área de input */
.chat-input-area,
.chat-input-wrapper {
    contain: layout style;
    transform: translate3d(0, 0, 0);
}

.chat-input-wrapper {
    backdrop-filter: blur(8px) saturate(160%);
    -webkit-backdrop-filter: blur(8px) saturate(160%);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Sombras simplificadas para el orbe */
.consciousness-orb {
    box-shadow: 0 0 18px rgba(79, 209, 197, 0.45), 0 0 32px rgba(79, 209, 197, 0.22);
    transform: translate3d(0, 0, 0);
}

.floating-orb {
    transform: translate3d(0, 0, 0);
}

/* Pausa animaciones mientras el usuario escribe */
body.is-typing .floating-orb,
body.is-typing .consciousness-orb,
body.is-typing .consciousness-orb *,
body.low-performance-mode .floating-orb,
body.low-performance-mode .consciousness-orb,
body.low-performance-mode .consciousness-orb * {
    animation-play-state: paused !important;
}


/* ===== Attachments UI (HealthIA) ===== */
.attachment-bar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  flex:1 1 100%;
  width:100%;
  padding:8px 10px;
  margin:0 6px 10px 6px;
  border:1px solid rgba(0,0,0,.08);
  border-radius:14px;
  background:rgba(255,255,255,.75);
  backdrop-filter: blur(6px);
}
.attachment-pill{
  display:flex;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  max-width:420px;
}
.attachment-name-btn{
  border:none;
  background:transparent;
  cursor:pointer;
  font-weight:600;
  font-size:13px;
  padding:0;
  max-width:320px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.attachment-remove-btn{
  width:22px;
  height:22px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.14);
  background:#fff;
  cursor:pointer;
  line-height:18px;
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.attach-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.10);
  background:rgba(255,255,255,.85);
  cursor:pointer;
}
.attach-btn svg{ display:block; }

/* Copy toast */
.copy-toast{
  position:fixed;
  left:50%;
  bottom:22px;
  transform:translateX(-50%) translateY(14px);
  opacity:0;
  pointer-events:none;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.12);
  background:rgba(30,30,30,.92);
  color:#fff;
  font-weight:600;
  font-size:13px;
  z-index:99999;
  transition:opacity .18s ease, transform .18s ease;
}
.copy-toast.visible{
  opacity:1;
  transform:translateX(-50%) translateY(0);
}

/* Attachment preview modal */
.apv-modal{ position:fixed; inset:0; display:none; z-index:99998; }
.apv-modal.open{ display:block; }
.apv-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.55); }
.apv-card{
  position:relative;
  max-width:min(980px, calc(100vw - 30px));
  max-height:calc(100vh - 30px);
  margin:15px auto;
  background:#fff;
  border-radius:18px;
  box-shadow:0 20px 80px rgba(0,0,0,.35);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.apv-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-bottom:1px solid rgba(0,0,0,.10);
}
.apv-title{ font-weight:800; }
.apv-close{
  width:36px;height:36px;border-radius:12px;
  border:1px solid rgba(0,0,0,.12);
  background:#fff;cursor:pointer;font-size:22px;line-height:0;
}
.apv-body{ padding:12px; overflow:auto; }
.apv-img{ max-width:100%; height:auto; border-radius:12px; }
.apv-iframe{ width:100%; height:70vh; border:0; border-radius:12px; }
.apv-pre{
  white-space:pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:13px;
}
.apv-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-top:10px;
  padding:8px 12px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,.12);
  background:#f8fafc;
  color:#0f172a;
  text-decoration:none;
  font-weight:600;
  font-size:13px;
}
.message-attachments{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:10px;
}
.message-attachment-image{
  max-width:220px;
  max-height:220px;
  border-radius:12px;
  border:1px solid rgba(15, 23, 42, 0.12);
  object-fit:cover;
}



/* ============================
   PATCH 2025-12-17 · ChatGPT-like centered column + input sizing + orb positioning
   - Centra el chat (contenido) sin que el textarea se estire infinito
   - Mantiene el scrollbar en el borde derecho del panel principal (no en el "hueco")
   - Reubica el orbe/gatito por encima del input y habilita drag real
   ============================ */

:root {
  --chatgpt-col-max: 48rem; /* ~768px, columna tipo ChatGPT */
  --chatgpt-gutter-min: 16px;
  --chatgpt-input-bottom-pad: 18px;
  --orb-safe-bottom: 132px; /* por encima del input */
}

/* Evita doble scroll: el scroll vive en el panel principal */
.chat-container,
body.chatgpt-clone {
  overflow: hidden;
}

.chat-container .main-panel {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Layout: el contenedor del chat ocupa el ancho disponible; el contenido se "centra" con padding */
.chat-layout {
  width: 100%;
  max-width: none;
}

/* Área principal del chat */
.chat-shell {
  width: 100%;
  max-width: none;
}

/* Importante: el contenedor que scrollea debe ser full-width para que la barra quede a la derecha */
.chat-area {
  overflow: hidden; /* mantiene el scroll en #chat-messages */
}

/* Scroll container full-width + gutters dinámicos para centrar el contenido */
.chat-messages {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;

  /* "Centro" estilo ChatGPT: padding que crea la columna sin limitar el scroll */
  padding-left: max(var(--chatgpt-gutter-min), calc((100% - var(--chatgpt-col-max)) / 2)) !important;
  padding-right: max(var(--chatgpt-gutter-min), calc((100% - var(--chatgpt-col-max)) / 2)) !important;

  overflow-y: auto !important;
  overflow-x: hidden !important;

  /* Espacio para que el último mensaje no quede debajo del input */
  padding-bottom: 168px !important;
}

/* Burbujas: comportamiento consistente (evita burbujas ultra-angostas) */
.message {
  width: fit-content;
  max-width: min(88%, var(--chatgpt-col-max));
  /*
    IMPORTANTE (2026-01-16):
    - Antes se usaba pre-wrap en la burbuja completa.
    - Cuando el contenido se inyecta como HTML (Markdown -> <p>/<ul>/<table>...), los "\n" del string HTML
      se convierten en nodos de texto con saltos visibles, creando espacios enormes (sobre todo en streaming
      y al rehidratar el chat).
    - La preservación de saltos de línea se debe aplicar SOLO a texto plano (usuario), no a HTML.
  */
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

/* Asegura que el contenedor de HTML renderizado no herede pre-wrap ni genere "saltos fantasma" */
.message .message-content {
  white-space: normal !important;
}

/* Mensajes de usuario: conservar saltos de línea si escribe en varias líneas */
.user-message,
.user-message .message-content {
  white-space: pre-wrap !important;
}

/* Streaming IA: aunque el JS use inline styles, forzamos HTML-friendly */
.ai-message .ai-streaming-content {
  white-space: normal !important;
}

.user-message,
.ai-message {
  max-width: min(88%, var(--chatgpt-col-max)) !important;
}

/* Input centrado y con ancho controlado */
.chat-input-area {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 40 !important;

  /* mismo "gutter" que la columna de mensajes */
  padding-left: max(var(--chatgpt-gutter-min), calc((100% - var(--chatgpt-col-max)) / 2)) !important;
  padding-right: max(var(--chatgpt-gutter-min), calc((100% - var(--chatgpt-col-max)) / 2)) !important;
  padding-bottom: var(--chatgpt-input-bottom-pad) !important;
  padding-top: 10px !important;

  background: linear-gradient(to top, rgba(253,253,251,0.98) 0%, rgba(253,253,251,0.65) 60%, rgba(253,253,251,0) 100%) !important;
  border-top: none !important;
}

/* wrapper: no se estira, queda como cápsula en el centro */
.chat-input-wrapper {
  width: 100% !important;
  max-width: var(--chatgpt-col-max) !important;
  margin: 0 auto !important;

  border-radius: 26px !important;
}

/* === Orbe / gatito: por encima del input y drag real === */
.floating-orb {
  pointer-events: auto !important; /* necesario para drag */
  bottom: var(--orb-safe-bottom) !important;
  right: 24px !important;
  animation: floatDrift 10s ease-in-out infinite;
}

.floating-orb .consciousness-orb {
  cursor: grab;
}

/* En pantallas pequeñas, sube un poco menos */
@media (max-width: 720px) {
  :root { --orb-safe-bottom: 148px; }
  .floating-orb { right: 14px !important; }
  .chat-input-area {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

/* Cuando el sidebar está colapsado: que no aparezca scroll “fantasma” dentro del rail */
.chat-container.sidebar-collapsed .sidebar,
.chat-container.sidebar-collapsed .sidebar-inner,
.chat-container.sidebar-collapsed .sidebar-bottom,
.chat-container.sidebar-collapsed .sidebar-top {
  overflow: hidden !important;
}



/* ChatGPT-like bubble action buttons (copy / feedback) */
.message .bubble-actions{
    display:flex;
    gap:6px;
    align-items:center;
    margin-top:8px;
    opacity:0;
    pointer-events:none;
    transition: opacity 120ms ease;
}
.message.ai-message .bubble-actions{ justify-content:flex-start; }
.message.user-message .bubble-actions{ justify-content:flex-end; }
.message:hover .bubble-actions{ opacity:1; pointer-events:auto; }
@media (hover: none){
    .message .bubble-actions{ opacity:1; pointer-events:auto; }
}

.bubble-action-btn{
    all: unset;
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.06);
    color: rgba(0,0,0,0.72);
}
.bubble-action-btn:hover{ background: rgba(0,0,0,0.06); }
.bubble-action-btn:active{ transform: translateY(0.5px); }
.bubble-action-btn.is-selected{
    background: rgba(16,185,129,0.14);
    border-color: rgba(16,185,129,0.35);
    color: rgba(16,185,129,0.95);
}
.bubble-action-btn svg{ pointer-events:none; }



/* ===========================
   HealthIA — Scrollbar como ChatGPT (al borde derecho)
   Pegar AL FINAL de styles.css
   =========================== */

/* 1) Variable única de ancho del sidebar (exp/colapsado) */
#chat-container { --sidebar-w: 260px; }
#chat-container.sidebar-collapsed { --sidebar-w: 90px; }

/* 2) Layout SIN columna "spacer":
      El panel principal ocupa hasta el borde derecho.
      El centrado se logra con padding-right simétrico. */
.chat-container{
  grid-template-columns: var(--sidebar-w) 1fr !important;
}

/* 3) Sidebar coherente con la variable */
.sidebar{ width: var(--sidebar-w) !important; }
.sidebar.collapsed{ width: var(--sidebar-w) !important; }

/* 4) Simetría tipo ChatGPT: espacio a la derecha igual al sidebar
      (mantiene el chat visualmente centrado, pero el scroll queda al borde) */
.main-panel{
  padding-right: var(--sidebar-w) !important;
  box-sizing: border-box;
}

/* 5) Asegura que el contenedor que scrollea no esté "capado" por max-width */
.chat-shell,
.chat-area{
  width: 100% !important;
  max-width: none !important;
}

/* 6) El scroller debe ser full-width para que el scrollbar quede al borde derecho */
#chat-messages.chat-messages{
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;

  /* Mantén el scroll aquí (si ya lo usas). Si prefieres scroll en la página,
     cambia a overflow-y: visible y elimina alturas fijas en padres. */
  overflow-y: auto !important;

  /* Evita que el scrollbar quede "encima" del contenido centrado */
  padding-right: max(1.25rem, calc((100% - 52rem) / 2)) !important;
  padding-left:  max(1.25rem, calc((100% - 52rem) / 2)) !important;
  padding-bottom: 180px !important;
}

/* 7) Estrellas ocultas al colapsar (por si aún no quedó) */
#chat-container.sidebar-collapsed .chat-session-star{
  display: none !important;
}



/* ==========================================================================
   HEALTHIA PATCH v4 — User bubble GREEN + actions OUTSIDE bubble + ChatGPT-like font
   Añadir al FINAL. (Override fuerte)
   ========================================================================== */

/* 0) Tipografía estilo ChatGPT (similar a la referencia) */
html, body, .chat-container, .main-panel, .chat-main, .chat-shell, .chat-messages, .message {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
               "Apple Color Emoji", "Segoe UI Emoji" !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

.message{
  font-size: 1rem !important;
  letter-spacing: 0 !important;
  line-height: 1.65 !important;
  font-weight: 400 !important;
}

/* 1) User bubble VERDE (forzar tanto por variable como por selector directo) */
:root{
  --user-message-bg: linear-gradient(135deg, #0f766e 0%, #10a37f 100%) !important;
  --user-text: #ffffff !important;
}

/* Si tu plantilla aplica el background directo a la clase, esto lo pisa igual */
.user-message,
.message.user-message,
.message.user{
  background: linear-gradient(135deg, #0f766e 0%, #10a37f 100%) !important;
  color: #ffffff !important;
  box-shadow: none !important;
  border: 1px solid rgba(16,163,127,0.25) !important;
  border-radius: 22px !important;
  font-weight: 450 !important;
}

/* 2) Acciones (copiar/like/dislike) visibles y FUERA del bubble
   Nota: se “sacan” con posicionamiento absoluto debajo del mensaje */
.message.user-message,
.message.user{
  position: relative !important;
  margin-bottom: 2.6rem !important; /* espacio para los iconos fuera */
}

.message.ai-message{
  position: relative !important;
  margin-bottom: 2.2rem !important; /* también espacio para acciones IA */
}

/* Mostrar acciones siempre (sin depender de hover) */
.message .bubble-actions{
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Sacar las acciones fuera del bubble (debajo) */
.message.user-message .bubble-actions,
.message.user .bubble-actions{
  position: absolute !important;
  right: 10px !important;
  bottom: -40px !important;
  margin: 0 !important;
  padding: 0 !important;
  justify-content: flex-end !important;
}

/* Para IA: debajo a la izquierda (estilo ChatGPT) */
.message.ai-message .bubble-actions{
  position: absolute !important;
  left: 0 !important;
  bottom: -38px !important;
  margin: 0 !important;
  padding: 0 !important;
  justify-content: flex-start !important;
}

/* Botones más ChatGPT: discretos, sin caja */
.bubble-action-btn{
  width: 32px !important;
  height: 32px !important;
  background: transparent !important;
  border: none !important;
  border-radius: 8px !important;
  color: #6b7280 !important;
  box-shadow: none !important;
}

.bubble-action-btn:hover{
  background: #e5e7eb !important;
  color: #111827 !important;
}

.bubble-action-btn svg{
  width: 18px !important;
  height: 18px !important;
}


/* ==========================================================================
   PATCH v5 — User bubble size + light green + typography tweaks
   ========================================================================== */

/* User bubble: light green, size fits content (no square/oversized bubble) */
.message.user-message,
.user-message {
  background: #dcfce7 !important;            /* light green */
  color: #064e3b !important;                 /* deep green text */
  border: 1px solid rgba(16,185,129,.18) !important;
  box-shadow: none !important;

  /* sizing */
  width: fit-content !important;
  max-width: 85% !important;
  height: auto !important;
  min-height: unset !important;

  /* spacing */
  padding: 12px 16px !important;
  border-radius: 18px !important;

  /* typography */
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji" !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  font-weight: 400 !important;

  /* layout */
  align-self: flex-end !important;
  text-align: left !important;
}

/* Ensure inner content doesn't add extra vertical bulk */
.message.user-message p,
.user-message p,
.message.user-message li,
.user-message li {
  margin: 0 !important;
  padding: 0 !important;
}

/* Keep bubble-actions outside user bubble (below, right) */
.message.user-message {
  position: relative !important;
  margin-bottom: 18px !important; /* room for action icons below */
}

.message.user-message .bubble-actions {
  position: absolute !important;
  right: 6px !important;
  bottom: -34px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 1 !important;
  justify-content: flex-end !important;
}

/* If you want ONLY copy icon under user bubble, hide others by class hooks if present */
.message.user-message .bubble-actions .like-btn,
.message.user-message .bubble-actions .dislike-btn {
  display: none !important;
}


/* ==========================================================================
   V6 — TIPOGRAFÍA MÁS ELEGANTE Y MODERNA
   (Forzar stack tipo ChatGPT/Inter y micro-ajustes de legibilidad)
   ========================================================================== */

:root {
  --healthia-font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --healthia-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

html, body,
button, input, textarea, select {
  font-family: var(--healthia-font-sans) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

/* Texto de chat (más compacto y moderno) */
.chat-messages,
.message,
.message p,
.message li {
  font-size: 15.5px !important;
  line-height: 1.55 !important;
  letter-spacing: -0.01em !important;
}

/* Peso normal tipo ChatGPT; user ligeramente más marcado */
.message { font-weight: 400 !important; }
.message.user-message { font-weight: 500 !important; }

/* Código */
.message code, .message pre, .message pre code {
  font-family: var(--healthia-font-mono) !important;
  font-size: 0.95em !important;
  letter-spacing: 0 !important;
}

/* =========================
   PATCH v6 — Auth modal pro (override del inline)
   ========================= */
.auth-overlay{
  background: rgba(10, 15, 20, 0.55) !important;
  backdrop-filter: blur(10px) !important;
}

.auth-modal{
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(250,252,251,0.88)) !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 76, 58, 0.14) !important;
  border-radius: 18px !important;
  box-shadow: 0 22px 60px rgba(0,0,0,0.25) !important;
  padding: 28px !important;
}

.auth-modal p{
  color: rgba(15, 23, 42, 0.70) !important;
}

.auth-modal button{
  border-radius: 12px !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em !important;
}

.auth-modal button.close-modal-btn{
  background: rgba(15, 23, 42, 0.08) !important;
  color: #0f172a !important;
}

.auth-modal input[type="email"],
.auth-modal input[type="password"]{
  color: #0f172a !important;
  background: rgba(248, 250, 252, 0.96) !important;
  border: 1px solid rgba(15, 76, 58, 0.16) !important;
}

.auth-modal input::placeholder{
  color: rgba(15, 23, 42, 0.55) !important;
}

/* =========================
   PATCH v6 — Bubble actions: limpio, premium, usable
   ========================= */
.message .bubble-actions{
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-2px);
  transition: opacity .18s ease, transform .18s ease !important;
}

.message:hover .bubble-actions,
.message:focus-within .bubble-actions{
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0);
}

.message .bubble-actions{
  gap: 6px !important;
  padding: 4px 6px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.75) !important;
  border: 1px solid rgba(15, 76, 58, 0.10) !important;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10) !important;
  backdrop-filter: blur(8px) !important;
}

.bubble-action-btn{
  width: 30px !important;
  height: 30px !important;
  border-radius: 10px !important;
  color: rgba(15, 23, 42, 0.65) !important;
}

.bubble-action-btn:hover{
  background: rgba(18, 184, 134, 0.12) !important;
  color: #0f172a !important;
}

@media (max-width: 720px){
  .message .bubble-actions{
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

/* =========================
   PATCH v6 — Bubble layout & typography
   ========================= */
.message{
  max-width: min(72ch, 86%) !important;
  border-radius: 18px !important;
  padding: 12px 16px !important;
  line-height: 1.6 !important;
}

.user-message{
  border-bottom-right-radius: 10px !important;
}

.ai-message{
  border-bottom-left-radius: 10px !important;
}

.message p{
  margin: 0.35rem 0 !important;
}
.message p:first-child{ margin-top: 0 !important; }
.message p:last-child{ margin-bottom: 0 !important; }
.message li{ margin: 0.12rem 0 !important; }

/* =========================
   PATCH v6 — Code blocks integrados al tema
   ========================= */
.message pre{
  background: rgba(15, 23, 42, 0.04) !important;
  border: 1px solid rgba(15, 76, 58, 0.12) !important;
  border-radius: 14px !important;
  padding: 12px 14px !important;
  overflow: auto !important;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08) !important;
}

.message code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  font-size: 0.94em !important;
}

/* =========================
   PATCH v6 — Animación suave de entrada
   ========================= */
.message.is-new{
  animation: slideUpFade .18s ease-out both;
}

/* ========================================================================
   PATCH v7 — IA sin burbuja + listas con emoji + tablas amplias + user wider
   ======================================================================== */
.message.ai-message{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  max-width: 100% !important;
}

.message.ai-message ul{
  list-style: none !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

.message.ai-message ul li{
  position: relative !important;
  padding-left: 1.6rem !important;
}

.message.ai-message ul li::before{
  content: "✅" !important;
  position: absolute !important;
  left: 0 !important;
  top: 0.1rem !important;
  font-size: 1rem !important;
  line-height: 1 !important;
}

.message.ai-message table{
  width: 100% !important;
  min-width: 480px !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #ffffff !important;
  border: 1px solid rgba(15, 76, 58, 0.14) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08) !important;
}

.message.ai-message table th,
.message.ai-message table td{
  padding: 10px 14px !important;
}

.message.user-message{
  max-width: 92% !important;
}

/* ========================================================================
   PATCH v8 — IA card layout + tablas premium (según referencia)
   ======================================================================== */
.message.ai-message{
  background: #ffffff !important;
  border: 1px solid rgba(15, 76, 58, 0.12) !important;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08) !important;
  border-radius: 18px !important;
  padding: 18px 20px !important;
  max-width: min(88%, 860px) !important;
}

.message.ai-message ul{
  list-style: none !important;
  padding-left: 0 !important;
  margin: 0.6rem 0 0.9rem !important;
}

.message.ai-message ul li{
  position: relative !important;
  padding-left: 1.7rem !important;
}

.message.ai-message ul li::before{
  content: "✅" !important;
  position: absolute !important;
  left: 0 !important;
  top: 0.1rem !important;
  font-size: 1rem !important;
  line-height: 1 !important;
}

.message.ai-message table{
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #ffffff !important;
  border: 1px solid #e4ece8 !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.06) !important;
}

.message.ai-message table thead th{
  background: #f3f7f5 !important;
  color: #0f172a !important;
  font-weight: 700 !important;
}

.message.ai-message table th,
.message.ai-message table td{
  padding: 14px 16px !important;
  border-right: 1px solid #e4ece8 !important;
  border-bottom: 1px solid #e4ece8 !important;
  text-align: left !important;
}

.message.ai-message table th:last-child,
.message.ai-message table td:last-child{
  border-right: none !important;
}

.message.ai-message table tr:last-child td{
  border-bottom: none !important;
}

.message.user-message{
  max-width: 94% !important;
}

/* ========================================================================
   PATCH v9 — IA sin burbuja + tablas premium + user bubble más ancho
   ======================================================================== */
.message.ai-message{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  max-width: 100% !important;
}



.message.ai-message ul,
.message.ai-message ol{
  list-style: none !important;
  padding-left: 0 !important;
  margin: 0.55rem 0 0.85rem !important;
}

.message.ai-message ul li,
.message.ai-message ol li{
  position: relative !important;
  padding-left: 1.45rem !important;
  margin: 0.18rem 0 !important;
}

/* Marcador por defecto: • (premium, sutil) */
.message.ai-message ul li::before,
.message.ai-message ol li::before{
  content: "•" !important;
  position: absolute !important;
  left: 0 !important;
  top: 0.08rem !important;
  font-size: 1.05rem !important;
  line-height: 1 !important;
  opacity: 0.75 !important;
}

/* Plan / manejo: ▸ */
.message.ai-message ul li.hl-plan::before,
.message.ai-message ol li.hl-plan::before{
  content: "▸" !important;
  opacity: 0.9 !important;
}

/* ✅ solo ocasional: se preserva solo en li.hl-ok */
.message.ai-message ul li.hl-ok::before,
.message.ai-message ol li.hl-ok::before{
  content: "✅" !important;
  opacity: 1 !important;
}

/* Bandera roja: barra izquierda roja + ⚠️ */
.message.ai-message ul.hl-redflag,
.message.ai-message ol.hl-redflag{
  position: relative !important;
  padding: 0.55rem 0.65rem 0.55rem 0.85rem !important;
  margin: 0.65rem 0 0.95rem !important;
  border-left: 4px solid rgba(220,38,38,0.92) !important;
  border-radius: 14px !important;
  background: rgba(220,38,38,0.04) !important;
}

.message.ai-message ul.hl-redflag li,
.message.ai-message ol.hl-redflag li{
  padding-left: 1.55rem !important;
}

.message.ai-message ul.hl-redflag li::before,
.message.ai-message ol.hl-redflag li::before{
  content: "⚠️" !important;
  opacity: 1 !important;
  top: 0.06rem !important;
}
.message.ai-message table{
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #ffffff !important;
  border: 1px solid #e4ece8 !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.06) !important;
}

.message.ai-message table thead th{
  background: #f3f7f5 !important;
  color: #0f172a !important;
  font-weight: 700 !important;
}

.message.ai-message table th,
.message.ai-message table td{
  padding: 14px 16px !important;
  border-right: 1px solid #e4ece8 !important;
  border-bottom: 1px solid #e4ece8 !important;
  text-align: left !important;
}

.message.ai-message table th:last-child,
.message.ai-message table td:last-child{
  border-right: none !important;
}

.message.ai-message table tr:last-child td{
  border-bottom: none !important;
}

.message.user-message{
  max-width: 96% !important;
}

/* ========================================================================
   PATCH v10 — Colores modernos + fondo claro + animaciones livianas
   ======================================================================== */
:root{
  --bg-color: #f7f8fb !important;
  --bg-gradient: radial-gradient(circle at top left, #eef6f4 0%, #fbfcff 45%) !important;
  --bg-color-alt: #f5f7fa !important;
  --primary-text-color: #0f172a !important;
  --secondary-text-color: #334155 !important;
  --border-color: rgba(15, 23, 42, 0.08) !important;
  --brand-primary: #0f766e !important;
  --brand-secondary: #22c55e !important;
  --brand-accent: #d1fae5 !important;
}

body{
  background: var(--bg-gradient) !important;
  color: var(--primary-text-color) !important;
}

.message.ai-message{
  color: var(--primary-text-color) !important;
}

.message.ai-message table{
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06) !important;
}

.message.ai-message table thead th{
  background: #eef2f7 !important;
}

.message.user-message{
  background: #dcfce7 !important;
  color: #0f172a !important;
  border: 1px solid rgba(34, 197, 94, 0.18) !important;
}

@media (prefers-reduced-motion: reduce){
  *{
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* PERF: elimina blur durante typing (reduce repaint masivo) */
body.is-typing .chat-input-wrapper{
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}


/* ===========================
   PERF: reduce jank while typing
   =========================== */
body.is-typing .attachment-bar{
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
  box-shadow:none !important;
}
body.is-typing .ad-banner{
  transition:none !important;
}

/* === PATCH 2025-12-29 · ChatGPT layout swap: main white, sidebar light gray === */
body.chatgpt-clone .sidebar{
  background:#f7f7f8;
  border:none;
  border-right:1px solid #e5e7eb;
  border-radius:0;
  box-shadow:none;
}
body.chatgpt-clone .main-panel{
  background:#ffffff;
}
body.chatgpt-clone .chat-container{
  background:#ffffff;
}
body.chatgpt-clone{
  background:#ffffff;
}



/* ================================
   ChatGPT-style shell (white main + light gray sidebar)
   Applies when <body class="chatgpt-clone">
================================ */
body.chatgpt-clone {
    background: #ffffff !important;
    background-image: none !important;
}

body.chatgpt-clone .chat-container {
    background: #ffffff !important;
}

body.chatgpt-clone .sidebar {
    background: #f7f7f8 !important;
    border-right: 1px solid #e5e7eb !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.chatgpt-clone .main-panel,
body.chatgpt-clone .main-content,
body.chatgpt-clone .chat-layout,
body.chatgpt-clone .chat-main,
body.chatgpt-clone .chat-area {
    background: #ffffff !important;
}

body.chatgpt-clone .chat-shell.glass-panel {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Top bar like ChatGPT (model selector on the left) */
body.chatgpt-clone .chat-toolbar.chatgpt-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 16px;
    margin: -0.9rem -1.1rem 0; /* cancel chat-shell padding so it spans full width */
}

body.chatgpt-clone .chatgpt-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

body.chatgpt-clone .chatgpt-model-select {
    position: relative;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.04);
    border: 1px solid rgba(17, 24, 39, 0.08);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    padding: 2px;
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

body.chatgpt-clone #mode-select {
    font-size: 14px;
    font-weight: 650;
    color: rgba(17, 24, 39, 0.92);
    border: none;
    background: transparent;
    padding: 8px 36px 8px 14px;
    border-radius: 999px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    letter-spacing: -0.01em;
    transition: background 160ms ease;
}

body.chatgpt-clone .chatgpt-model-select:hover {
    background: rgba(17, 24, 39, 0.06);
    border-color: rgba(17, 24, 39, 0.12);
}

body.chatgpt-clone .chatgpt-model-select:focus-within {
    background: #ffffff;
    border-color: rgba(15, 76, 58, 0.32);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.16);
}

body.chatgpt-clone #mode-select:focus-visible {
    background: rgba(17, 24, 39, 0.03);
}

body.chatgpt-clone .chatgpt-model-caret {
    position: absolute;
    right: 12px;
    pointer-events: none;
    font-size: 12px;
    color: #6b7280;
}

/* Accessibility helper */
body.chatgpt-clone .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Disclaimer under the input like ChatGPT */
body.chatgpt-clone .chat-disclaimer {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    padding: 6px 12px 10px;
}

body.chatgpt-clone .chat-input-wrapper {
    background: #ffffff;
    box-shadow: 0 0 0 1px #e5e7eb, 0 10px 24px rgba(0,0,0,0.04);
}

body.chatgpt-clone .chat-input-area {
    padding-bottom: 8px;
}

/* === PATCH 2025-12-29 · Disclaimer debajo del input (no dentro) === */
body.chatgpt-clone .chat-input-area{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  pointer-events:none; /* conserva el comportamiento original */
}
body.chatgpt-clone .chat-input-wrapper{
  width:min(860px, 100%);
  pointer-events:auto; /* interactivo */
}
body.chatgpt-clone .chat-disclaimer{
  width:min(860px, 100%);
  pointer-events:auto;
  margin:0;
  padding:0 12px 10px;
  font-size:12px;
  color:#6b7280;
  text-align:center;
}

/* === PATCH 2025-12-29 · Input sin blur/sombra pesada (reduce lag al escribir) === */
body.chatgpt-clone .chat-input-wrapper{
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
  box-shadow:none !important;
}
body.chatgpt-clone textarea,
body.chatgpt-clone .chat-input,
body.chatgpt-clone .message-input{
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
}

/* === PERF/UX: kill injected ad banners that deform chat layout === */
ins.adsbygoogle,
iframe[id^="google_ads"],
iframe[src*="doubleclick"],
iframe[src*="googlesyndication"],
div[id^="google_ads"],
div[aria-label*="advert"],
div[class*="ad-banner"],
div[class*="ads"],
#google_ads_iframe_,
#google_image_div,
#ad-banner-container,
#ad-banner,
.ad-top,
.ad-bottom,
.ad-slot {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}


/* ===== Sandbox status pill (visible while tools run) ===== */
.sandbox-status{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  margin:10px 0 14px 0;
  border-radius:14px;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.20);
  color:#0f172a;
  font-size:14px;
  line-height:1.2;
}
.sandbox-status .dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background: rgba(16,185,129,1);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.55);
  animation: sandboxPulse 1.25s infinite;
}
.sandbox-status .label{ font-weight:600; }
.sandbox-status .meta{ opacity:0.85; font-weight:500; }

@keyframes sandboxPulse {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.55); }
  70% { box-shadow: 0 0 0 10px rgba(16,185,129,0.0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.0); }
}


/* --- NUEVA TIPOGRAFÍA ESTILO "CLAUDE/PREMIUM" --- */

/* Contenedor general del mensaje */
.ai-message .ai-streaming-content,
.ai-message .md-chunk,
.ai-message .message-content,
.ai-message .split-bubble {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.75;
    font-size: 1.05rem;
    color: var(--primary-text-color);
}

/* Títulos (H1, H2, H3) */
.ai-message h1, .ai-message h2, .ai-message h3 {
    font-family: 'Merriweather', serif;
    color: var(--brand-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.ai-message h1 {
    font-size: 1.8rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(0,0,0,0.10);
    padding-bottom: 0.5rem;
}

.ai-message h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.ai-message h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary-text-color);
}

/* Párrafos */
.ai-message p {
    margin-bottom: 1.25em;
}

/* Negritas */
.ai-message strong, .ai-message b {
    font-weight: 600;
    color: var(--brand-primary);
}

/* Listas */
.ai-message ul, .ai-message ol {
    margin-bottom: 1.25em;
    padding-left: 1.5rem;
}

.ai-message li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

/* Bloques de código */
.ai-message pre {
    background: #f4f4f5;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
    margin-bottom: 1.5em;
}

/* Citas */
.ai-message blockquote {
    border-left: 4px solid var(--brand-secondary);
    background-color: var(--brand-accent);
    margin: 1.5em 0;
    padding: 0.75em 1em;
    font-style: italic;
    color: var(--button-bg-strong);
    border-radius: 0 8px 8px 0;
}



/* === UI Patch: Bubble actions fixed + tooltip + bottom padding (2026-01-08) === */

/* Ensure bubble is positioning context */
.message { position: relative; }

/* Space so actions do not cover the last line */
.message .message-content { padding-bottom: 46px; }

/* Anchor actions inside bubble */
.bubble-actions{
  position: absolute;
  right: 12px;
  bottom: 10px;

  margin-top: 0 !important;

  display: inline-flex;
  gap: 8px;
  align-items: center;

  padding: 6px 8px;
  border-radius: 16px;

  background: rgba(255,255,255,0.70);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 10px 26px rgba(0,0,0,0.14);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  z-index: 5;
}

/* Keep your “hover to show” behavior */
.message:hover .bubble-actions{ opacity: 1; pointer-events: auto; }

/* Tooltip from data-tip (no native title tooltip) */
.bubble-action-btn{ position: relative; }

.bubble-action-btn[data-tip]:hover::after{
  content: attr(data-tip);
  position: absolute;
  right: 0;
  bottom: 44px;

  padding: 6px 10px;
  border-radius: 10px;

  font-size: 12px;
  line-height: 1;
  white-space: nowrap;

  color: #fff;
  background: rgba(20,20,20,0.92);
  border: 1px solid rgba(255,255,255,0.12);

  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  pointer-events: none;
}

/* little caret */
.bubble-action-btn[data-tip]:hover::before{
  content: "";
  position: absolute;
  right: 12px;
  bottom: 38px;
  width: 10px;
  height: 10px;
  background: rgba(20,20,20,0.92);
  transform: rotate(45deg);
  border-right: 1px solid rgba(255,255,255,0.12);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  pointer-events: none;
}


/* =========================
   FIXES: Sidebar colapsada (sin sesión) + Stream status único + Send/Stop
   ========================= */

/* 1) Sidebar colapsada: botones login/register no deben romper el layout */
.sidebar.collapsed #login-buttons{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  padding: 0 6px;
}
.sidebar.collapsed #login-buttons button{
  width:44px;
  height:44px;
  padding:0;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:0;          /* ocultar texto para evitar wrap */
  line-height:0;
  white-space:nowrap;
}
.sidebar.collapsed #login-buttons button::before{
  font-size:18px;
  line-height:1;
}
.sidebar.collapsed #login-btn::before{ content:"⎆"; }        /* icono login */
.sidebar.collapsed #register-btn::before{ content:"＋"; }    /* icono register */

/* Tooltip básico */
.sidebar.collapsed #login-buttons button[title=""]{ }

/* 2) Stream status (microfeedback) - píldora única estilo ChatGPT */
#stream-status.stream-status{
  position: sticky;
  bottom: 0;
  margin: 10px auto 0 auto;
  width: fit-content;
  max-width: min(92%, 520px);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 8px 22px rgba(0,0,0,0.08);
  color: rgba(20, 30, 40, 0.82);
  font-size: 13px;
  font-weight: 500;
  z-index: 30;
}
#stream-status.stream-status.is-hidden{
  display:none !important;
}
#stream-status.stream-status.is-thinking::after{
  content: "...";
  display:inline-block;
  width: 0;
  overflow: hidden;
  vertical-align: bottom;
  animation: healthiaDots 1.1s steps(4, end) infinite;
  margin-left: 6px;
  opacity: 0.7;
}
@keyframes healthiaDots{
  0%{ width:0; }
  100%{ width: 1.3em; }
}

/* 3) Botón enviar/parar: pequeño feedback visual */
#send-btn.is-stop{
  background: rgba(16,163,127,0.12);
  border-color: rgba(16,163,127,0.25);
}

/* --- FUTURISTIC AUTH MODAL START (Bio‑Digital Glassmorphism) --- */

.auth-overlay{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 10, 15, 0.65) !important;
  backdrop-filter: blur(12px) saturate(100%);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
  z-index: 9999;
  padding: 16px;
}

.auth-modal{
  background: linear-gradient(145deg, rgba(20, 35, 30, 0.90), rgba(10, 20, 18, 0.95)) !important;
  border: 1px solid rgba(16, 185, 129, 0.30) !important;
  box-shadow:
    0 20px 50px rgba(0,0,0,0.50),
    0 0 0 1px rgba(16, 185, 129, 0.10),
    inset 0 0 20px rgba(16, 185, 129, 0.05) !important;
  border-radius: 24px !important;
  padding: 3rem 2.5rem !important;
  max-width: 420px !important;
  width: min(92vw, 420px) !important;
  color: #e2e8f0 !important;
  position: relative;
  overflow: hidden;
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal::before{
  content:'';
  position:absolute;
  top:-50%;
  left:-50%;
  width:200%;
  height:200%;
  background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.15), transparent 60%);
  pointer-events:none;
  z-index:0;
}

@keyframes modalSlideUp{
  from{ opacity:0; transform: translateY(30px) scale(0.95); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}

.auth-modal h2{
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 800;
  font-size: 1.8rem !important;
  margin: 0 0 0.5rem !important;
  background: linear-gradient(to right, #0f172a, #0f766e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  z-index: 1;
}

.auth-modal p{
  color: rgba(148, 163, 184, 0.98) !important;
  font-size: 0.95rem !important;
  margin: 0 0 1.75rem !important;
  position: relative;
  z-index: 1;
}

.auth-modal form{
  display:flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 0;
  position: relative;
  z-index: 1;
}

.auth-modal label{
  font-size: 0.85rem !important;
  font-weight: 700;
  color: rgba(100, 116, 139, 0.95) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0.25rem 0 0.2rem;
  display:block;
}

.auth-modal input{
  width: 100%;
  background: rgba(0,0,0,0.30) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: 12px !important;
  padding: 12px 16px !important;
  color: #ffffff !important;
  font-size: 1rem !important;
  transition: all 0.25s ease;
  outline: none;
}

.auth-modal input::placeholder{
  color: rgba(226, 232, 240, 0.55);
}

.auth-modal input:focus{
  border-color: rgba(16, 185, 129, 0.95) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.20) !important;
  background: rgba(0,0,0,0.50) !important;
}

/* Botones principales */
.auth-modal button[type="submit"],
#google-signin-btn-login,
#google-signin-btn-register{
  background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
  border: none !important;
  border-radius: 14px !important;
  padding: 14px !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.30);
  position: relative;
  overflow: hidden;
  z-index: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  width: 100%;
}

.auth-modal button[type="submit"]:hover,
#google-signin-btn-login:hover,
#google-signin-btn-register:hover{
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.50);
  filter: saturate(1.05);
}

.auth-modal button[type="submit"]:active,
#google-signin-btn-login:active,
#google-signin-btn-register:active{
  transform: translateY(0);
}

.auth-modal button svg{
  display:block;
}

/* Botón cerrar */
.close-modal-btn{
  width: 100%;
  margin-top: 1rem !important;
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: rgba(148, 163, 184, 0.95) !important;
  border-radius: 14px !important;
  padding: 12px 14px !important;
}

.close-modal-btn:hover{
  background: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
}

/* Divider */
.auth-divider{
  display:flex;
  align-items:center;
  gap: 10px;
  margin: 1.5rem 0;
  color: rgba(100, 116, 139, 0.95);
  position: relative;
  z-index: 1;
}
.auth-divider hr{
  flex:1;
  border:0;
  border-top:1px solid rgba(255,255,255,0.10);
}
.auth-divider span{
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Row: remember + reset */
.auth-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}
.auth-remember{
  display:flex;
  align-items:center;
  gap: 8px;
  text-transform:none !important;
  letter-spacing: normal !important;
  font-weight: 600 !important;
  color: rgba(15, 23, 42, 0.78);
  margin: 0 !important;
}
.auth-remember input{
  width: 16px !important;
  height: 16px !important;
  padding: 0 !important;
  border-radius: 4px !important;
}
.auth-link-btn{
  background: transparent !important;
  border: none !important;
  color: rgba(167, 243, 208, 0.95) !important;
  padding: 6px 0 !important;
  width: auto !important;
  box-shadow: none !important;
  font-weight: 700 !important;
  cursor: pointer;
  text-decoration: none;
}
.auth-link-btn:hover{
  text-decoration: underline;
}

/* Hint & error */
.auth-hint{
  margin: 0.75rem 0 0 !important;
  font-size: 0.9rem !important;
  color: rgba(226, 232, 240, 0.92) !important;
  position: relative;
  z-index: 1;
}
.login-error{
  margin: 0.75rem 0 0 !important;
  color: #fecaca !important;
  background: rgba(239, 68, 68, 0.12) !important;
  border: 1px solid rgba(239, 68, 68, 0.18) !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  font-size: 0.92rem !important;
  position: relative;
  z-index: 1;
}

/* --- ANIMACIÓN DE CARGA FUTURISTA --- */
.btn-processing{
  pointer-events:none;
  color: transparent !important;
  position: relative;
}
.btn-processing::after{
  content:'';
  position:absolute;
  left:50%;
  top:50%;
  width:20px;
  height:20px;
  margin-left:-10px;
  margin-top:-10px;
  border:2px solid rgba(255,255,255,0.30);
  border-top-color:#ffffff;
  border-radius:50%;
  animation: btnSpin 0.8s infinite linear;
}
.btn-processing::before{
  content:'';
  position:absolute;
  inset:0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.20), transparent);
  transform: translateX(-100%);
  animation: btnScan 1.5s infinite;
}
@keyframes btnSpin{ to{ transform: rotate(360deg); } }
@keyframes btnScan{ 100%{ transform: translateX(100%); } }

/* Avatar selection */
.avatar-selection{
  margin-top: 1rem;
  padding-top: 0.25rem;
  position: relative;
  z-index: 1;
}
.avatar-selection h2{
  font-size: 1.1rem !important;
  -webkit-text-fill-color: unset;
  color: #e2e8f0 !important;
  background: none !important;
  margin-top: 0.75rem !important;
}
.avatar-options{
  display:flex;
  gap: 14px;
  margin-top: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.avatar-options img{
  width: 72px;
  height: 72px;
  border-radius: 999px;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
}
.avatar-options img.selected{
  border-color: rgba(16,185,129,0.95);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.20), 0 10px 24px rgba(0,0,0,0.25);
}

/* --- END FUTURISTIC AUTH --- */



/* =========================
   AUTH PATCH v2 — Inputs claros en focus/autofill + tonos modernos
   ========================= */

/* Paleta moderna (Aurora Mint) solo para Auth */
:root{
  --auth-overlay: rgba(7, 14, 22, 0.62);
  --auth-surface-1: rgba(255, 255, 255, 0.94);
  --auth-surface-2: rgba(248, 250, 252, 0.90);
  --auth-border: rgba(2, 132, 199, 0.18);
  --auth-glow: rgba(16, 185, 129, 0.18);
  --auth-accent-1: #10B981; /* emerald */
  --auth-accent-2: #0EA5E9; /* sky */
  --auth-accent-3: #6366F1; /* indigo (toques) */
  --auth-text: #0f172a;
  --auth-muted: rgba(15, 23, 42, 0.68);
}

/* Overlay más premium, sin endurecer inputs */
.auth-overlay{
  background: var(--auth-overlay) !important;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

/* Modal: vidrio claro con borde aurora */
.auth-modal{
  background: linear-gradient(145deg, var(--auth-surface-1), var(--auth-surface-2)) !important;
  color: var(--auth-text) !important;
  border: 1px solid var(--auth-border) !important;
  box-shadow:
    0 22px 65px rgba(0,0,0,0.28),
    0 0 0 1px rgba(255,255,255,0.55),
    inset 0 0 28px rgba(14, 165, 233, 0.06),
    inset 0 0 28px rgba(16, 185, 129, 0.05) !important;
  position: relative;
  overflow: hidden;
}

/* Halo aurora superior */
.auth-modal::before{
  content: "";
  position: absolute;
  inset: -40% -30%;
  background:
    radial-gradient(circle at 20% 20%, rgba(14,165,233,0.18), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(16,185,129,0.14), transparent 60%),
    radial-gradient(circle at 60% 80%, rgba(99,102,241,0.10), transparent 62%);
  pointer-events: none;
  z-index: 0;
}

/* Asegura que el contenido quede encima del halo */
.auth-modal > *{
  position: relative;
  z-index: 1;
}

.auth-modal p{ color: var(--auth-muted) !important; }

/* Inputs: SIEMPRE claros, incluso focus/autofill */
.auth-modal input[type="email"],
.auth-modal input[type="password"]{
  background: rgba(255,255,255,0.92) !important;
  color: var(--auth-text) !important;
  border: 1px solid rgba(2, 132, 199, 0.16) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
  caret-color: var(--auth-accent-1);
}

.auth-modal input:focus{
  background: rgba(255,255,255,0.98) !important;
  border-color: rgba(16,185,129,0.55) !important;
  box-shadow:
    0 0 0 3px rgba(16,185,129,0.18),
    0 0 0 1px rgba(14,165,233,0.12) inset !important;
  outline: none !important;
}

/* Chrome/Safari autofill: evita que se "ponga negro" o cambie a tonos raros */
.auth-modal input:-webkit-autofill,
.auth-modal input:-webkit-autofill:hover,
.auth-modal input:-webkit-autofill:focus{
  -webkit-text-fill-color: var(--auth-text) !important;
  caret-color: var(--auth-accent-1) !important;
  box-shadow: 0 0 0 1000px rgba(255,255,255,0.98) inset !important;
  transition: background-color 9999s ease-out 0s;
}

/* Botones: gradiente moderno (emerald->sky) */
.auth-modal button[type="submit"],
#google-signin-btn-login,
#google-signin-btn-register{
  background: linear-gradient(135deg, var(--auth-accent-1) 0%, var(--auth-accent-2) 100%) !important;
  box-shadow: 0 10px 28px rgba(14,165,233,0.18), 0 8px 22px rgba(16,185,129,0.16) !important;
}

.auth-modal button[type="submit"]:hover,
#google-signin-btn-login:hover,
#google-signin-btn-register:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(14,165,233,0.22), 0 14px 34px rgba(16,185,129,0.18) !important;
}

/* Botón cancelar: más fino, moderno */
.close-modal-btn{
  border: 1px solid rgba(2,132,199,0.14) !important;
  color: rgba(15,23,42,0.72) !important;
  background: rgba(255,255,255,0.55) !important;
}
.close-modal-btn:hover{
  background: rgba(255,255,255,0.80) !important;
  color: var(--auth-text) !important;
}

/* =========================
   END AUTH PATCH v2
   ========================= */


/* --- Health-IA Auth: fixes de lectura y branding (2026-01) --- */
.auth-modal #login-title{
  background: linear-gradient(135deg, var(--auth-accent-1, #10b981), var(--auth-accent-2, #0284c7));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  letter-spacing: -0.02em;
}

.auth-modal .auth-strapline{
  margin: -6px 0 0 0;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.82);
}

.auth-modal .auth-desc{
  margin-top: 6px;
  color: color-mix(in srgb, var(--auth-text, rgba(15,23,42,0.92)) 78%, transparent);
}

.auth-remember,
.auth-remember span{
  color: var(--auth-text, rgba(15,23,42,0.92)) !important;
}

.auth-link-btn{
  color: var(--auth-accent-2, #0284c7) !important;
}

.auth-link-btn:hover{
  filter: brightness(0.95);
  text-decoration: underline;
}

/* ==============================
   ChatGPT-like: "bajar al final"
   ============================== */
#scroll-jump-bottom {
  position: fixed;
  right: 18px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(14, 94, 70, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
  cursor: pointer;
  z-index: 1200;

  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, box-shadow .18s ease;
}

#scroll-jump-bottom.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#scroll-jump-bottom:hover {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.14);
  transform: translateY(-1px);
}

#scroll-jump-bottom:active {
  transform: translateY(0);
}

#scroll-jump-bottom .sj-icon {
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  color: #0e5e46;
}

#scroll-jump-bottom .sj-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #0e5e46;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

/* Ajuste para pantallas pequenas */
@media (max-width: 640px) {
  #scroll-jump-bottom {
    right: 12px;
    bottom: calc(108px + env(safe-area-inset-bottom));
    width: 42px;
    height: 42px;
  }
}

/* Dark-mode (si lo usas por clase) */
body.dark #scroll-jump-bottom,
html.dark #scroll-jump-bottom {
  background: rgba(17, 24, 39, 0.92);
  border-color: rgba(255, 255, 255, 0.14);
}
body.dark #scroll-jump-bottom .sj-icon,
html.dark #scroll-jump-bottom .sj-icon {
  color: #a7f3d0;
}
body.dark #scroll-jump-bottom .sj-badge,
html.dark #scroll-jump-bottom .sj-badge {
  border-color: rgba(17, 24, 39, 0.92);
}


/* ========================================================================
   PATCH v9.1 — Normaliza espaciado (evita saltos grandes al recargar)
   ======================================================================== */
.message.ai-message p{
  margin: 0.38rem 0 !important;
}
.message.ai-message .split-bubble{
  margin-bottom: 0.38rem !important;
}
.message.ai-message .split-bubble:last-child{
  margin-bottom: 0 !important;
}

@media (max-width: 640px){
  .ai-message .ai-streaming-content,
  .ai-message .md-chunk,
  .ai-message .message-content,
  .ai-message .split-bubble{
    font-size: 0.98rem !important;
    line-height: 1.58 !important;
  }
}

/* ==========================================================================
   PATCH v10 — User bubble WHITE + premium typography + markdown bold
   Añadir al FINAL. (Override fuerte)
   ========================================================================== */

/* 1) Variables (afecta hero bubbles y cualquier componente que use var()) */
:root{
  --user-message-bg: #ffffff !important;
  --user-text: #0f172a !important;
}

/* 2) Bubble de usuario en cualquier layout (si algo lo fuerza verde, esto lo pisa) */
.user-message,
.message.user-message,
.message.user{
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 76, 58, 0.14) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06) !important;
}

/* 3) Hero demo bubbles (landing) */
.hero-bubble.user-bubble{
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 76, 58, 0.14) !important;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08) !important;
}

/* 4) Tipografía premium: Inter como base; pesos consistentes */
html, body, .chat-container, .main-panel, .chat-main, .chat-shell, .chat-messages, .message{
  font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

.message{
  font-size: 16px !important;
  line-height: 1.62 !important;
  font-weight: 450 !important; /* base elegante; no "pesado" */
  letter-spacing: -0.005em !important;
}

/* 5) Negrita solo cuando markdown lo pide */
.message strong,
.message b,
.message .md-chunk strong,
.message .md-chunk b{
  font-weight: 700 !important;
}

/* 6) Ajuste fino de headings en markdown para look premium */
.message h1,
.message h2,
.message h3,
.message h4,
.message h5,
.message h6{
  font-weight: 750 !important;
  letter-spacing: -0.015em !important;
}

/* 7) Links más sobrios */
.message a{
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}


/* HealthIA: anclas invisibles para insertar gráficos inline */
.healthia-chart-anchor{display:block;height:0;line-height:0;margin:0;padding:0;}


/* ========================================================================
   PATCH v10 — Editorial No-Bubble + Chart Cards (Premium/Notion-like)
   Objetivo:
   - IA: respuesta tipo documento (sin burbuja) con ancla lateral sutil.
   - Usuario: píldora minimalista a la derecha.
   - Gráficos: tarjetas de insights embebidas (no JSON crudo).
   ======================================================================== */

:root{
  --healthia-text-soft: #1F2937;         /* gris casi negro (fatiga baja) */
  --healthia-text-muted: #6B7280;
  --healthia-border-soft: rgba(15, 76, 58, 0.10);
  --healthia-border-softer: rgba(15, 76, 58, 0.08);
  --healthia-shadow-soft: 0 10px 30px rgba(0,0,0,0.04);
}

/* ---------- IA: estilo editorial (sin burbuja) ---------- */
.message.ai-message{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  max-width: 100% !important;
}

/* Contenido con ancho de lectura y ancla lateral */
.message.ai-message .message-content,
.message.ai-message .ai-streaming-content,
.message.ai-message .md-chunk,
.ai-message .message-content,
.ai-message .ai-streaming-content,
.ai-message .md-chunk{
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 0 10px 0 22px;
  border-left: 3px solid rgba(16,185,129,0.28); /* brand-secondary suave */
  color: var(--healthia-text-soft) !important;
}

/* Marca/ícono discreto al inicio (opcional, no invasivo) */
.message.ai-message .message-content:first-child::before,
.message.ai-message .ai-streaming-content:first-child::before{
  content: "HealthIA";
  display: inline-block;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: rgba(15, 76, 58, 0.62);
  margin: 0 0 10px 0;
}

/* Tipografía de cuerpo (gris suave) */
.ai-message .ai-streaming-content,
.ai-message .md-chunk,
.ai-message .message-content,
.ai-message .split-bubble{
  color: var(--healthia-text-soft) !important;
}

/* Negritas: no verde intenso (mejor legibilidad) */
.ai-message strong, .ai-message b{
  color: var(--healthia-text-soft) !important;
  font-weight: 650 !important;
}

/* Listas: sin emojis, espaciado editorial */
.message.ai-message ul,
.message.ai-message ol{
  list-style: disc !important;
  padding-left: 1.25rem !important;
  margin: 0.8rem 0 1.0rem !important;
}
.message.ai-message li{
  margin: 0 0 0.75rem !important;
}
.message.ai-message ul li::before,
.message.ai-message ol li::before{
  content: none !important;
}
.message.ai-message ul li::marker,
.message.ai-message ol li::marker{
  color: rgba(15, 76, 58, 0.55);
}

/* Tablas: estilo documento (sin rejilla dura; separadores horizontales) */
.message.ai-message table{
  width: 100% !important;
  border-collapse: collapse !important;
  background: #ffffff !important;
  border: 1px solid rgba(15, 76, 58, 0.10) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06) !important;
}
.message.ai-message table thead th{
  background: rgba(15, 76, 58, 0.05) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
}
.message.ai-message table th,
.message.ai-message table td{
  padding: 12px 14px !important;
  border-right: none !important;
  border-bottom: 1px solid rgba(15, 76, 58, 0.08) !important;
}
.message.ai-message table tr:last-child td{
  border-bottom: none !important;
}

/* ---------- Usuario: píldora minimalista ---------- */
.message.user-message{
  background: #F3F4F6 !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  box-shadow: none !important;
  border-radius: 24px !important;
  padding: 12px 16px !important;
  max-width: min(72ch, 86%) !important;
  margin-left: auto !important;
}

/* ---------- Anclas de gráficos (no visibles) ---------- */
.healthia-chart-anchor{ display:none !important; }

/* ---------- Gráficos: tarjeta premium embebida ---------- */
.chat-bubble-chart{
  max-width: 860px;
  width: 100%;
  margin: 18px auto 20px !important;
  padding: 22px 22px 18px !important;
  border-radius: 16px !important;
  background: #FFFFFF !important;
  border: 1px solid var(--healthia-border-softer) !important;
  box-shadow: var(--healthia-shadow-soft) !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.chat-bubble-chart:hover{
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.06) !important;
}

.chat-bubble-chart-header{
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 14px !important;
  margin-bottom: 12px !important;
  padding-bottom: 10px !important;
  border-bottom: 1px solid rgba(0,0,0,0.035) !important;
}

.chat-bubble-chart-title{
  font-family: 'Merriweather', serif !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  color: var(--brand-primary) !important;
}

/* elimina el emoji heredado */
.chat-bubble-chart-title::before{ content: '' !important; }

.chat-bubble-chart-note{
  margin-top: 6px !important;
  font-size: 0.82rem !important;
  color: var(--healthia-text-muted) !important;
}

.chat-bubble-chart-toprow{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
  width:100%;
}

.chat-bubble-chart-actions{
  display:flex;
  gap: 8px;
  align-items:center;
}

.chart-action-btn{
  appearance:none;
  border: 1px solid rgba(15, 76, 58, 0.14);
  background: rgba(15, 76, 58, 0.04);
  color: rgba(15, 76, 58, 0.92);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.chart-action-btn:hover{
  background: rgba(16,185,129,0.10);
  transform: translateY(-1px);
}

.chat-bubble-chart-canvas-wrap{
  height: 260px !important;
}

/* Oculta cualquier JSON crudo si por error queda renderizado */
.raw-chart-json{ display:none !important; }


/* === PATCH v10 — Editorial canvas + chart cards (2026-01-19) === */

:root{
  --text-ink: #1F2937;
  --text-ink-soft: rgba(31,41,55,0.92);
  --hairline: rgba(15, 76, 58, 0.10);
  --hairline-strong: rgba(15, 76, 58, 0.14);
}

/* IA: estilo editorial (sin burbuja) */
.message.ai-message{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  max-width: 100% !important;
}

/* Contenido IA: ancho de lectura cómodo + ancla visual */
.message.ai-message .message-content,
.ai-message .message-content,
.ai-message .md-chunk,
.ai-message .ai-streaming-content,
.ai-message .split-bubble{
  max-width: 820px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding-left: 22px !important;
  border-left: 3px solid rgba(16, 185, 129, 0.35) !important; /* brand-secondary suave */
}

/* Micro-identidad (icono discreto al inicio) */
.message.ai-message .message-content > :first-child{
  position: relative;
}
.message.ai-message .message-content > :first-child::before{
  content: "";
  position: absolute;
  left: -22px;
  top: 0.10rem;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.85);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

/* Tipografía IA: tinta suave (no negro puro) */
.ai-message .ai-streaming-content,
.ai-message .md-chunk,
.ai-message .message-content,
.ai-message .split-bubble{
  color: var(--text-ink-soft) !important;
}

/* Negritas IA: no verdes por defecto (solo énfasis, no “link-like”) */
.ai-message strong,
.ai-message b{
  color: var(--text-ink) !important;
  font-weight: 650 !important;
}

/* Listas IA: bullets editoriales, sin emojis */
.message.ai-message ul,
.message.ai-message ol{
  list-style: disc !important;
  padding-left: 1.25rem !important;
  margin: 0.8rem 0 1.1rem !important;
}
.message.ai-message ol{ list-style: decimal !important; }
.message.ai-message li{
  margin: 0 0 12px 0 !important;
  padding-left: 0 !important;
}
.message.ai-message li::before{ content: none !important; }
.message.ai-message ul li::marker,
.message.ai-message ol li::marker{
  color: rgba(16, 185, 129, 0.85);
}

/* Tablas IA: estilo “Notion” (sin grid duro) */
.message.ai-message table{
  width: 100% !important;
  border-collapse: collapse !important;
  background: #fff !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06) !important;
}
.message.ai-message table thead th{
  background: rgba(16, 185, 129, 0.06) !important;
  color: var(--text-ink) !important;
  font-weight: 700 !important;
}
.message.ai-message table th,
.message.ai-message table td{
  border-right: none !important;
  border-left: none !important;
  border-top: none !important;
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
  padding: 12px 14px !important;
}
.message.ai-message table tr:last-child td{ border-bottom: none !important; }

/* Usuario: píldora minimalista (contraste con IA) */
.message.user-message{
  background: #F3F4F6 !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  box-shadow: none !important;
  border-radius: 24px !important;
  padding: 12px 16px !important;
  max-width: min(74ch, 86%) !important;
  margin-left: auto !important;
}

/* INPUT: efecto flotante suave (manteniendo tu layout original) */
.chat-input-container,
.input-container,
.chat-input{
  box-shadow: 0 20px 40px rgba(0,0,0,0.08) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}

/* Anclas de gráficos (no visibles) */
.healthia-chart-anchor{ display:none !important; }

/* Gráficos: tarjeta premium (reusa clase existente .chat-bubble-chart) */
.chat-bubble-chart{
  background: #FFFFFF !important;
  border: 1px solid rgba(15, 76, 58, 0.08) !important;
  border-radius: 16px !important;
  padding: 22px 22px 18px !important;
  margin: 18px auto 22px !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.04) !important;
  max-width: 820px !important;
  width: 100% !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease !important;
}
.chat-bubble-chart:hover{
  transform: translateY(-2px) !important;
  box-shadow: 0 16px 36px rgba(0,0,0,0.06) !important;
}

.chat-bubble-chart-header{
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-bottom: 12px !important;
  padding-bottom: 10px !important;
  border-bottom: 1px solid rgba(0,0,0,0.04) !important;
}

.chat-bubble-chart-title{
  font-family: 'Merriweather', serif !important;
  font-size: 0.98rem !important;
  font-weight: 800 !important;
  color: var(--brand-primary) !important;
}

.chat-bubble-chart-title::before{ content: '' !important; }

.chat-bubble-chart-note{
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  font-size: 0.82rem !important;
  color: rgba(31,41,55,0.70) !important;
  margin-top: 4px !important;
}

.chat-bubble-chart-actions{
  display: inline-flex !important;
  gap: 8px !important;
}

.chart-action-btn{
  appearance: none;
  border: 1px solid rgba(15, 76, 58, 0.14);
  background: rgba(255,255,255,0.85);
  color: rgba(15, 23, 42, 0.78);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.chart-action-btn:hover{
  background: rgba(16,185,129,0.10);
  border-color: rgba(16,185,129,0.25);
  color: rgba(15, 23, 42, 0.92);
}

.chat-bubble-chart-canvas-wrap{
  height: 260px !important;
}

/* =========================================================
   Premium Editorial UI Overrides (2026-01-19)
   - IA sin burbuja (salida tipo documento)
   - Usuario en capsula/pildora
   - Tarjetas de graficos embebidos (Chart JSON)
   - Sidebar + Topbar mas "premium"
   ========================================================= */

:root {
  --text-strong: #111827;
  --text-body: #1F2937;
  --text-muted-2: #4B5563;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --surface-3: #F3F4F6;
  --line-soft: rgba(17, 24, 39, 0.06);
  --line-softer: rgba(17, 24, 39, 0.04);
  --shadow-soft: 0 12px 28px rgba(0,0,0,0.06);
  --shadow-softer: 0 10px 30px rgba(0,0,0,0.04);
  --radius-xl: 18px;
  --radius-pill: 999px;
}

/* ---------- Topbar ---------- */
.chat-toolbar {
  background: rgba(255,255,255,0.88) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft) !important;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}

.chat-toolbar .mode-select {
  background: rgba(255,255,255,0.92) !important;
  border: 1px solid var(--line-soft) !important;
  border-radius: var(--radius-pill) !important;
  padding: 10px 14px !important;
  box-shadow: 0 10px 24px rgba(0,0,0,0.04);
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: rgba(255,255,255,0.84) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--line-soft) !important;
}

.sidebar-header {
  border-bottom: 1px solid var(--line-softer) !important;
}

#new-chat-btn {
  border-radius: 14px !important;
  box-shadow: 0 10px 22px rgba(0,0,0,0.05);
}

.sidebar-menu li a {
  border-radius: 12px !important;
}

.sidebar-menu li a.active {
  box-shadow: 0 12px 26px rgba(0,0,0,0.05);
}

/* Evita mostrar el bloque de usuario en modo guest incluso si algo lo habilita */
.sidebar-user[data-auth-state="guest"],
#user-info[data-auth-state="guest"] {
  display: none !important;
}

/* ---------- Mensajes: IA editorial, usuario capsula ---------- */
.message {
  color: var(--text-body);
}

/* Usuario: capsula/pildora */
.message.user-message,
.user-message {
  background: var(--surface-3) !important;
  border: 1px solid var(--line-soft) !important;
  border-radius: 22px !important;
  padding: 12px 14px !important;
  box-shadow: 0 8px 18px rgba(0,0,0,0.04);
}

.message.user-message .message-content,
.user-message .message-content {
  color: var(--text-strong) !important;
  font-weight: 500;
}

/* IA: sin burbuja (tipo documento) */
.message.ai-message,
.ai-message {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: var(--chatgpt-col-max) !important;
}

.message.ai-message .message-content,
.ai-message .message-content {
  background: transparent !important;
  border-left: 3px solid rgba(15, 76, 58, 0.22);
  padding-left: 18px;
  margin: 10px 0 12px 6px;
  color: var(--text-body) !important;
  line-height: 1.75;
}

/* Encabezados dentro de la IA (editorial) */
.message.ai-message h1,
.message.ai-message h2,
.message.ai-message h3,
.ai-message h1,
.ai-message h2,
.ai-message h3 {
  font-family: 'Merriweather', serif;
  color: var(--brand-primary);
  letter-spacing: -0.01em;
}

/* Texto menos "negro puro" */
.message.ai-message p,
.message.ai-message li,
.ai-message p,
.ai-message li {
  color: var(--text-body);
}

.message.ai-message strong,
.ai-message strong {
  color: var(--text-strong);
}

/* Tablas: estilo Notion (sin grid duro) */
.message.ai-message table,
.ai-message table {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.message.ai-message table thead th,
.ai-message table thead th {
  background: #FAFAFA;
  border-bottom: 1px solid var(--line-soft) !important;
}

.message.ai-message table th,
.message.ai-message table td,
.ai-message table th,
.ai-message table td {
  border: none !important;
  border-bottom: 1px solid var(--line-softer) !important;
}

.message.ai-message table tr:last-child td,
.ai-message table tr:last-child td {
  border-bottom: none !important;
}

/* Listas con mas "aire" */
.message.ai-message ul li,
.message.ai-message ol li,
.ai-message ul li,
.ai-message ol li {
  margin-bottom: 10px;
}

/* ---------- Graficos embebidos (Chart JSON) ---------- */
.chat-bubble-chart {
  background: #FFFFFF;
  border: 1px solid rgba(15, 76, 58, 0.10);
  border-radius: 16px;
  padding: 18px;
  margin: 16px 0;
  box-shadow: var(--shadow-softer);
  max-width: 100%;
}

.chat-bubble-chart-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.chat-bubble-chart-title {
  font-family: 'Merriweather', serif;
  font-size: 0.95rem;
  color: var(--brand-primary);
  font-weight: 700;
}

.chat-bubble-chart-actions button {
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 6px 10px;
  background: rgba(255,255,255,0.9);
}

/* ---------- Input: flotante tipo premium ---------- */
.chat-input-area {
  background: linear-gradient(to top, rgba(255,255,255,0.96) 0%, rgba(255,255,255,0.65) 60%, rgba(255,255,255,0) 100%) !important;
}

.chat-input-wrapper {
  border-radius: 18px !important;
  border: 1px solid var(--line-soft) !important;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Scrollbars discretos */
.sidebar *::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 10px;
}
.sidebar *::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.6);
}

/* =========================
   Login layout + sidebar clinical hierarchy tweaks (2026-02)
   ========================= */

.auth-modal{
  border-radius: 28px !important;
  padding: 2.8rem 2.6rem 2.4rem !important;
  text-align: center;
}

.auth-brand{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 1.4rem;
}

.auth-brand-logo{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.14), rgba(14, 165, 233, 0.1));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.auth-brand-logo svg{
  width: 26px;
  height: 26px;
}

.auth-brand-name{
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: rgba(15, 23, 42, 0.72);
  text-transform: uppercase;
}

.auth-modal form{
  text-align: left;
}

.auth-modal h2{
  font-size: 1.9rem !important;
  margin-bottom: 0.35rem !important;
}

.auth-modal p{
  font-size: 0.95rem !important;
  margin-bottom: 1.65rem !important;
}

.auth-divider{
  justify-content: center;
}

body.chatgpt-clone .sidebar{
  background: transparent !important;
  border-right: none !important;
  padding: 0.9rem 0.9rem !important;
}

body.chatgpt-clone .sidebar-inner{
  background: #f9fafb;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.06);
  padding: 0.9rem 0.9rem 1rem;
  height: 100%;
}

body.chatgpt-clone .sidebar-header{
  margin-bottom: 1.2rem;
}

body.chatgpt-clone .brand-mark{
  padding: 0;
  background: transparent;
}

body.chatgpt-clone .brand-mark::before{
  display: none;
}

body.chatgpt-clone .sidebar-header .logo{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 10px 18px rgba(15, 23, 42, 0.12);
}

body.chatgpt-clone #new-chat-btn{
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #111827;
  font-weight: 600;
}

body.chatgpt-clone #new-chat-btn svg{
  opacity: 0.7;
}

body.chatgpt-clone #new-chat-btn:hover{
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
  color: #065f46;
}

body.chatgpt-clone .sidebar-menu li a{
  font-size: 0.9rem;
  color: rgba(17, 24, 39, 0.78);
}

body.chatgpt-clone .sidebar-menu li a:hover,
body.chatgpt-clone .sidebar-menu li a.active{
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

body.chatgpt-clone .sidebar-menu .sidebar-icon{
  color: rgba(17, 24, 39, 0.6);
}

body.chatgpt-clone .sidebar-divider{
  height: 1px;
  background: rgba(148, 163, 184, 0.35);
  margin: 0.65rem 0 0.55rem;
}

body.chatgpt-clone .sidebar-section-label{
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(100, 116, 139, 0.8);
  margin: 0 0 0.35rem;
}

body.chatgpt-clone .user-profile{
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

body.chatgpt-clone .sidebar-user{
  gap: 8px;
}

body.chatgpt-clone .sidebar-user-name{
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
}

body.chatgpt-clone #login-buttons button{
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #111827;
  font-weight: 600;
}

body.chatgpt-clone #login-buttons button:hover{
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.18);
}

body.chatgpt-clone #logout-menu{
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

body.chatgpt-clone .chat-session-star{
  display: none;
}

body.chatgpt-clone .chat-session-item{
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
}

body.chatgpt-clone .chat-session-item:hover{
  background: rgba(15, 23, 42, 0.05);
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

body.chatgpt-clone .chat-session-title{
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(17, 24, 39, 0.7);
}

body.chatgpt-clone .chat-session-preview{
  font-size: 0.72rem;
  color: rgba(100, 116, 139, 0.8);
}

body.chatgpt-clone .sidebar.collapsed{
  padding: 0.8rem 0.6rem !important;
}

body.chatgpt-clone .sidebar.collapsed .sidebar-inner{
  padding: 0.8rem 0.5rem 0.9rem;
  border-radius: 16px;
}

/* =========================
   Auth clean card layout (reference match)
   ========================= */
.auth-overlay{
  background: rgba(17, 24, 39, 0.75) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 32px 16px !important;
}

.auth-modal{
  background: #ffffff !important;
  color: #111827 !important;
  border-radius: 16px !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25) !important;
  padding: 48px 56px 40px !important;
  width: min(92vw, 520px) !important;
  text-align: center;
}

.auth-modal::before{
  display: none !important;
}

.auth-brand{
  margin-bottom: 24px;
}

.auth-brand-logo{
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f3f4f6;
  box-shadow: none;
}

.auth-brand-name{
  color: #111827;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.auth-modal h2{
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  margin-bottom: 0.5rem !important;
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
  background: none !important;
}

.auth-modal p{
  font-size: 0.9rem !important;
  color: #6b7280 !important;
  margin-bottom: 1.25rem !important;
}

.auth-modal form{
  text-align: left;
  gap: 12px;
}

.auth-modal label{
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em;
  color: #6b7280 !important;
}

.auth-modal input[type="email"],
.auth-modal input[type="password"]{
  background: #ffffff !important;
  color: #111827 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
  box-shadow: none !important;
}

.auth-modal input:focus{
  border-color: #16a34a !important;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18) !important;
}

.auth-modal button[type="submit"]{
  background: #15803d !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  padding: 12px 14px !important;
}

.auth-modal button[type="submit"]:hover{
  background: #166534 !important;
  box-shadow: none !important;
  transform: none;
}

.auth-divider{
  margin: 1.5rem 0;
  color: #9ca3af;
}

.auth-divider hr{
  border-top: 1px solid #e5e7eb;
}

#google-signin-btn-login,
#google-signin-btn-register{
  background: #ffffff !important;
  color: #111827 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  font-weight: 600 !important;
}

#google-signin-btn-login:hover,
#google-signin-btn-register:hover{
  background: #f9fafb !important;
}

.auth-row{
  margin-top: 6px;
}

.auth-remember,
.auth-remember span{
  color: #6b7280 !important;
  font-weight: 500 !important;
}

.auth-link-btn{
  color: #15803d !important;
  font-weight: 600 !important;
}

.close-modal-btn{
  border: none !important;
  background: transparent !important;
  color: #6b7280 !important;
  padding: 10px 0 !important;
}

.close-modal-btn:hover{
  color: #111827 !important;
  background: transparent !important;
}

/* ===== Gaming / Puzzles Rich Blocks ===== */
.chat-grid{
  display:grid;
  gap:6px;
  padding:12px;
  border:1px solid rgba(15,23,42,0.10);
  border-radius:14px;
  background: rgba(248,250,252,0.85);
  box-shadow: 0 10px 30px rgba(2,6,23,0.06);
  width: fit-content;
  max-width: 100%;
  overflow:auto;
}
.chat-grid__cell{
  width: var(--cell, 28px);
  height: var(--cell, 28px);
  border-radius:10px;
  background:#ffffff;
  border:1px solid rgba(15,23,42,0.10);
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  user-select:none;
}
.chat-grid__cell.is-wall{
  background: rgba(15,23,42,0.90);
  border-color: rgba(15,23,42,0.90);
}
.chat-grid__cell.is-path{
  outline: 2px solid rgba(16,185,129,0.40);
  outline-offset: -2px;
  background: rgba(16,185,129,0.10);
}
.chat-grid__cell.is-start{
  background: rgba(59,130,246,0.14);
  outline: 2px solid rgba(59,130,246,0.55);
  outline-offset: -2px;
}
.chat-grid__cell.is-goal{
  background: rgba(16,185,129,0.14);
  outline: 2px solid rgba(16,185,129,0.55);
  outline-offset: -2px;
}
.chat-grid__cell.is-mark.tone-warning{
  background: rgba(245,158,11,0.14);
  outline: 2px solid rgba(245,158,11,0.55);
  outline-offset: -2px;
}
.chat-grid__cell.is-mark.tone-danger{
  background: rgba(239,68,68,0.14);
  outline: 2px solid rgba(239,68,68,0.55);
  outline-offset: -2px;
}
.chat-grid__inner{
  font-weight:900;
  font-size:12px;
  color: rgba(15,23,42,0.90);
}
.chat-grid__cell.is-wall .chat-grid__inner{
  color: rgba(15,23,42,0);
}
.chat-grid__coord{
  position:absolute;
  bottom:3px;
  right:6px;
  font-size:9px;
  font-weight:700;
  color: rgba(15,23,42,0.45);
}
.chat-trace{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:10px 2px;
}
.chat-trace__row{
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.chat-trace__tick{
  min-width:44px;
  text-align:right;
  font-weight:900;
  font-size:11px;
  color: rgba(15,23,42,0.55);
  padding-top:4px;
}
.chat-trace__card{
  flex:1;
  border:1px solid rgba(15,23,42,0.10);
  border-radius:14px;
  padding:10px 12px;
  background:#fff;
  box-shadow: 0 8px 22px rgba(2,6,23,0.06);
}
.chat-trace__title{
  font-weight:900;
  font-size:12px;
  color: rgba(15,23,42,0.90);
}
.chat-trace__detail{
  margin-top:6px;
  font-size:12px;
  color: rgba(15,23,42,0.70);
  line-height:1.35;
}
.chat-game-state{
  margin: 10px 0 8px 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(2,6,23,0.92);
  color: rgba(226,232,240,0.95);
  font-size: 12px;
  line-height: 1.35;
  overflow:auto;
  border: 1px solid rgba(148,163,184,0.18);
}
.chat-game-state__bar{
  display:flex;
  gap:8px;
  justify-content:flex-end;
}
.chat-ui-btn{
  appearance:none;
  border:1px solid rgba(15,23,42,0.12);
  background: rgba(248,250,252,0.95);
  color: rgba(15,23,42,0.85);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  font-size: 12px;
  cursor:pointer;
}
.chat-ui-btn:hover{
  filter: brightness(0.98);
}
