@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Poppins:wght@400;500;600;700&display=swap');

:root {
  /* Tonos exactos proporcionados por el usuario */
  --brand-green: #06500C;
  --brand-green-rgb: 6, 80, 12;
  --brand-green-dark: #043808;
  --brand-green-mid: #096811;
  --brand-green-soft: rgba(6, 80, 12, 0.22);

  --brand-gold: #E8B904;
  --brand-gold-rgb: 232, 185, 4;
  --brand-gold-hover: #F5C71A;
  --brand-gold-soft: rgba(232, 185, 4, 0.16);

  /* Tema Noche (Oscuro por defecto, fiel a Alex AI) */
  --bg-outer: #1E221F;
  --bg-app: #3B3B3B;
  --bg-app-gradient: radial-gradient(circle at 50% -15%, #27422A 0%, #3B3B3B 62%);
  --bg-surface: #313131;
  --bg-surface-elevated: #454547;
  --bg-input: #313131;
  --bg-nav: #2C2C2C;
  --bg-modal: #3B3B3B;
  --bg-chip: #474747;

  --text-primary: #F7F8F8;
  --text-secondary: #D0D3D6;
  --text-muted: #9A9EA4;
  --text-on-gold: #1E1E1E;
  --text-on-green: #FFFFFF;

  --border-color: #535455;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --watermark-opacity: 0.035;
  --shadow-app: 0 24px 70px rgba(0, 0, 0, 0.55);
  --online-dot: #61CF8E;
  --danger-color: #EF4444;
}

/* Modo Día (Claro) */
body.theme-day {
  --bg-outer: #E4EBE5;
  --bg-app: #F5F7FA;
  --bg-app-gradient: radial-gradient(circle at 50% -15%, rgba(6, 80, 12, 0.12) 0%, #F5F7FA 62%);
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #EDF1EE;
  --bg-input: #FFFFFF;
  --bg-nav: #FFFFFF;
  --bg-modal: #FFFFFF;
  --bg-chip: #EAEeea;

  --text-primary: #1F2421;
  --text-secondary: #434A45;
  --text-muted: #6E7670;
  --text-on-gold: #1A1A1A;
  --text-on-green: #FFFFFF;

  --border-color: #D5DDD7;
  --border-subtle: rgba(6, 80, 12, 0.12);
  --watermark-opacity: 0.04;
  --shadow-app: 0 20px 60px rgba(6, 80, 12, 0.15);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  position: fixed;
  inset: 0;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Regular', sans-serif;
  background-color: var(--bg-outer);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
  background-color: var(--brand-gold);
  color: #000;
}

/* Barra flotante en escritorio para alternar vista móvil / pantalla completa */
.desktop-toolbar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9000;
  display: flex;
  gap: 8px;
}

.desktop-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  transition: all 0.2s ease;
}

.desktop-toolbar-btn:hover {
  border-color: var(--brand-gold);
}

@media (max-width: 600px) {
  .desktop-toolbar {
    display: none;
  }
}

/* Contenedor principal de la App (Marco móvil en PC o Pantalla Completa) */
.app-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: min(890px, calc(100% - 32px));
  background: var(--bg-app);
  background-image: var(--bg-app-gradient);
  border-radius: 38px;
  border: 6px solid #222523;
  box-shadow: var(--shadow-app);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.37, 0.01, 0, 0.98);
}

body.theme-day .app-shell {
  border-color: #CBD4CD;
}

body.fullscreen-mode .app-wrapper {
  padding: 0;
}

body.fullscreen-mode .app-shell {
  max-width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
}

@media (max-width: 600px) {
  .app-wrapper {
    padding: 0;
  }
  .app-shell {
    max-width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
}

/* Filtro de Luz Azul (Protector ocular ajustable) */
.blue-light-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8500;
  background: rgba(255, 166, 0, 0);
  mix-blend-mode: multiply;
  transition: background 0.15s ease;
}

body:not(.theme-day) .blue-light-overlay {
  mix-blend-mode: screen;
}

/* Marca de agua 'A' decorativa al estilo Alex AI */
.bg-watermark {
  position: absolute;
  right: -45px;
  bottom: 60px;
  width: 320px;
  height: 420px;
  pointer-events: none;
  opacity: var(--watermark-opacity);
  z-index: 0;
}

/* ==========================================
   LOGO ALBERTO (A con raya horizontal debajo)
   ========================================== */
.alberto-logo {
  display: inline-flex;
  align-items: baseline;
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  letter-spacing: -0.04em;
  user-select: none;
  line-height: 1;
}

.alberto-logo .logo-a-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-right: 1px;
}

.alberto-logo .logo-a-letter {
  color: var(--text-primary);
  font-weight: 900;
}

.alberto-logo .logo-a-underline {
  display: block;
  width: 92%;
  height: 0.13em;
  min-height: 3px;
  background-color: var(--brand-gold);
  border-radius: 99px;
  margin-top: 1px;
}

.alberto-logo .logo-rest {
  color: var(--text-primary);
  font-weight: 800;
}

/* ==========================================
   FLUJO DE ENTRADA (ONBOARDING - PANTALLAS 1 Y 3, IGUAL A BaseOnboardingScreen DE ALEX AI)
   ========================================== */
.onboarding-layer {
  position: absolute;
  inset: 0;
  z-index: 500;
  background: var(--bg-app);
  background-image: var(--bg-app-gradient);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) clamp(16px, 5vw, 24px) calc(16px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.onboarding-layer.hidden {
  display: none !important;
}

/* Barra superior de progreso de Onboarding */
.onboarding-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
  padding-bottom: 6px;
  flex-shrink: 0;
}

.onboarding-back-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.onboarding-back-btn:hover {
  border-color: var(--brand-gold);
}

.onboarding-progress {
  flex: 1;
  display: flex;
  gap: 8px;
}

.onboarding-progress-segment {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--border-color);
  overflow: hidden;
}

.onboarding-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--brand-gold);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.onboarding-progress-segment.active .onboarding-progress-fill {
  width: 100%;
}

/* Estructura de cada pantalla de Onboarding (LayoutBuilder + SingleChildScrollView + botón fijo abajo) */
.onboarding-step {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: none;
  flex-direction: column;
  justify-content: space-between;
}

.onboarding-step.active {
  display: flex;
  animation: fadeSlideIn 0.35s ease forwards;
}

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

.greeting-center {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 12px;
}

.greeting-line-1 {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: clamp(28px, 7.5vw, 34px);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.greeting-line-1 .alberto-logo {
  font-size: clamp(38px, 10vw, 46px);
}

.greeting-subtitle {
  margin-top: 10px;
  font-size: clamp(20px, 5.5vw, 24px);
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: -0.02em;
}

.onboarding-bottom {
  flex-shrink: 0;
  width: 100%;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.btn-gold {
  width: 100%;
  height: clamp(46px, 6.5vh, 52px);
  border-radius: 100px;
  border: none;
  background-color: var(--brand-gold);
  color: var(--text-on-gold);
  font-family: 'Inter', sans-serif;
  font-size: clamp(15.5px, 4vw, 17px);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 6px 20px rgba(232, 185, 4, 0.24);
}

.btn-gold:hover:not(:disabled) {
  background-color: var(--brand-gold-hover);
}

.btn-gold:active:not(:disabled) {
  transform: scale(0.985);
}

.btn-gold:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.onboarding-legal-note {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: center;
  max-width: 340px;
}

.onboarding-legal-note a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.onboarding-legal-note a:hover {
  color: var(--brand-gold);
}

/* Pantalla 3 (Paso 2 tras quitar la de 1,5M): Importante que sepas / Términos (Scrollable + adaptable) */
.terms-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(10px, 2vh, 16px);
  padding: clamp(6px, 1.5vh, 12px) 2px;
}

.terms-badge-icon {
  width: clamp(44px, 6.5vh, 54px);
  height: clamp(44px, 6.5vh, 54px);
  border-radius: 14px;
  background: var(--brand-green);
  border: 1px solid rgba(232, 185, 4, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-gold);
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(6, 80, 12, 0.35);
}

.terms-welcome-tag {
  font-size: clamp(12px, 3.2vw, 13.5px);
  font-weight: 600;
  color: var(--brand-gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.terms-heading {
  font-size: clamp(22px, 6vw, 27px);
  font-weight: 800;
  line-height: 1.16;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.terms-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: clamp(12px, 2vh, 16px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.4vh, 12px);
}

.terms-card p {
  font-size: clamp(13px, 3.5vw, 14.5px);
  line-height: 1.45;
  color: var(--text-secondary);
}

.terms-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: clamp(10px, 1.8vh, 14px) 14px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: border-color 0.2s ease;
}

.terms-checkbox-row:hover {
  border-color: var(--brand-gold);
}

.terms-checkbox-row input {
  display: none;
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.2s ease;
}

.custom-checkbox svg {
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.terms-checkbox-row input:checked + .custom-checkbox {
  background-color: var(--brand-green);
  border-color: var(--brand-gold);
}

.terms-checkbox-row input:checked + .custom-checkbox svg {
  opacity: 1;
  transform: scale(1);
}

.terms-checkbox-text {
  font-size: clamp(12.5px, 3.3vw, 13.5px);
  line-height: 1.38;
  color: var(--text-primary);
  font-weight: 500;
}

/* En pantallas móviles de altura compacta, alinear arriba dentro del área scrollable para que nunca corte ni el icono ni el botón inferior */
@media (max-height: 740px) {
  .terms-content {
    justify-content: flex-start;
  }
}

/* ==========================================
   ESTRUCTURA PRINCIPAL DE LA APP (CABECERA, VISTAS, TAB BAR)
   ========================================== */
.main-app-layer {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-screen {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.tab-screen.active {
  display: flex;
}

/* Cabecera estilo Alex AI */
.alex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

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

.header-brand .alberto-logo {
  font-size: 26px;
}

.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-chip);
  color: var(--online-dot);
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 500;
}

.online-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--online-dot);
  box-shadow: 0 0 8px var(--online-dot);
}

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

.btn-new-chat {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background-color: var(--brand-gold);
  color: #1E1E1E;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-new-chat:hover {
  background-color: var(--brand-gold-hover);
  transform: scale(1.06);
}

/* ==========================================
   PESTAÑA 1: CHAT DE ALBERTO AI
   ========================================== */
.chat-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.chat-scroll-area::-webkit-scrollbar {
  width: 4px;
}

.chat-scroll-area::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  width: 100%;
  animation: fadeInMsg 0.35s ease forwards;
}

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

.msg-row.assistant {
  align-items: flex-start;
}

.msg-row.user {
  align-items: flex-end;
}

.bubble {
  max-width: 88%;
  padding: 13px 15px;
  font-size: 15.5px;
  line-height: 1.45;
  overflow-wrap: break-word;
  position: relative;
}

/* Burbuja de Alberto (IA) - Texto 100% en un único color y sin negrita */
.msg-row.assistant .bubble {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 400;
  border-radius: 15px 15px 15px 0;
  border: 1px solid var(--border-subtle);
}

.msg-row.assistant .bubble-text,
.msg-row.assistant .bubble-text p,
.msg-row.assistant .bubble-text li,
.msg-row.assistant .bubble-text ul,
.msg-row.assistant .bubble-text ol,
.msg-row.assistant .bubble-text strong,
.msg-row.assistant .bubble-text b,
.msg-row.assistant .bubble-text em,
.msg-row.assistant .bubble-text i,
.msg-row.assistant .bubble-text a,
.msg-row.assistant .bubble-text span {
  color: var(--text-primary) !important;
  font-weight: 400 !important;
  font-style: normal !important;
}

/* Burbuja del Usuario con el tono exacto de verde (#06500C) */
.msg-row.user .bubble {
  background: linear-gradient(90deg, var(--brand-green) 0%, var(--brand-green-mid) 100%);
  color: var(--text-on-green);
  border-radius: 15px 15px 0 15px;
  border: 1px solid rgba(232, 185, 4, 0.22);
}

.bubble p {
  margin-bottom: 8px;
}

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

.bubble ul, .bubble ol {
  margin: 8px 0 8px 20px;
}

.bubble li {
  margin-bottom: 4px;
}

.bubble li.sub-bullet {
  margin-left: 16px;
  list-style-type: circle;
}

.bubble strong, .bubble b {
  color: inherit;
  font-weight: 400;
}

.bubble a {
  color: inherit;
  text-decoration: underline;
  font-weight: 400;
}

body.theme-day .msg-row.assistant .bubble strong {
  color: inherit;
  font-weight: 400;
}

.bubble-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 6px;
}

.msg-row.user .bubble-footer {
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 0;
}

.rating-buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rating-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s ease, transform 0.2s ease;
}

.rating-btn:hover,
.rating-btn.selected {
  color: var(--brand-gold);
}

.msg-timestamp {
  font-size: 11px;
  color: var(--text-muted);
}

.msg-row.user .msg-timestamp {
  color: rgba(255, 255, 255, 0.72);
}

@keyframes shake {
  0% { transform: scale(1); }
  25% { transform: scale(0.88); }
  50% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.shake {
  animation: shake 0.4s ease;
}

/* Tarjeta de archivo adjunto dentro del mensaje o formulario */
.attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(232, 185, 4, 0.35);
  margin-bottom: 8px;
}

.attachment-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand-gold);
  color: #1E1E1E;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attachment-card-info {
  flex: 1;
  min-width: 0;
}

.attachment-card-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-card-type {
  font-size: 11px;
  opacity: 0.8;
}

.attachment-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* Indicador de carga de 3 puntos */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 4px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--brand-gold);
  animation: dotPulse 1.4s infinite ease-in-out;
}

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

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.15); }
}

/* Indicador de Tool Calling + RAG (Estilo Alex AI) */
.tool-call-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-gold);
  background: rgba(232, 185, 4, 0.12);
  border: 1px solid rgba(232, 185, 4, 0.32);
  padding: 5px 11px;
  border-radius: 99px;
  margin-bottom: 9px;
  letter-spacing: 0.01em;
  transition: all 0.25s ease;
}

.tool-call-badge.completed {
  color: #61CF8E;
  background: rgba(97, 207, 142, 0.12);
  border-color: rgba(97, 207, 142, 0.32);
}

.tool-call-spinner {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid rgba(232, 185, 4, 0.35);
  border-top-color: var(--brand-gold);
  animation: spinTool 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes spinTool {
  to { transform: rotate(360deg); }
}

.streaming-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background-color: var(--brand-gold);
  vertical-align: text-bottom;
  margin-left: 3px;
  border-radius: 2px;
  animation: blinkCursor 0.8s steps(2, start) infinite;
}

@keyframes blinkCursor {
  to { visibility: hidden; }
}

.btn-stop-stream {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #FFFFFF;
  color: #2B2B2B;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

.btn-stop-stream.visible {
  display: inline-flex;
}

.btn-stop-stream:hover {
  transform: scale(1.06);
}

/* Composer inferior idéntico al de la captura de Alex AI */
.chat-composer-wrap {
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-app);
  flex-shrink: 0;
}

.composer-attachment-preview {
  display: none;
  margin-bottom: 8px;
}

.composer-attachment-preview.visible {
  display: flex;
}

.chat-composer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-attach-clip {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-attach-clip:hover {
  color: var(--brand-gold);
  border: 1px solid var(--brand-gold);
}

.composer-input-box {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 22px;
  padding: 6px 10px 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.2s ease;
}

.composer-input-box:focus-within {
  border-color: var(--brand-gold);
}

.composer-textarea {
  width: 100%;
  max-height: 96px;
  min-height: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 21px;
  resize: none;
  outline: none;
  caret-color: var(--brand-gold);
}

.composer-textarea::placeholder {
  color: var(--text-muted);
}

.btn-voice-mic {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-voice-mic:hover {
  color: var(--brand-gold);
}

.btn-voice-mic.recording {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
  animation: pulseMic 1s infinite ease-in-out;
}

@keyframes pulseMic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}

.btn-send-msg {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-send-msg.ready {
  background: var(--brand-gold);
  color: #1E1E1E;
  box-shadow: 0 3px 12px rgba(232, 185, 4, 0.3);
}

/* ==========================================
   PESTAÑA 2: CONSULTAS (HISTORIAL)
   ========================================== */
.screen-header-large {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.screen-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.consultas-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 20px;
}

.consulta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.consulta-item:hover {
  opacity: 0.88;
}

.consulta-main {
  flex: 1;
  min-width: 0;
}

.consulta-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.consulta-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.consulta-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--brand-gold);
  color: var(--brand-gold);
  background: var(--brand-gold-soft);
}

.consulta-tag.green {
  border-color: #28A745;
  color: #48D567;
  background: rgba(6, 80, 12, 0.35);
}

body.theme-day .consulta-tag.green {
  color: var(--brand-green);
  border-color: var(--brand-green);
  background: rgba(6, 80, 12, 0.1);
}

.consulta-preview {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.consulta-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.btn-delete-consulta {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.btn-delete-consulta:hover {
  color: var(--danger-color);
}

/* ==========================================
   PESTAÑAS 3 Y 4: EXPLORAR Y TOOLS (ARQUITECTURA EXACTA DE ALEX AI ADAPTADA A ALBERTO)
   ========================================== */
.explore-segmented-wrap {
  padding: 12px 20px 0;
  flex-shrink: 0;
}

.explore-segmented {
  display: flex;
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--border-color);
}

.segmented-tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.segmented-tab.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.explore-feed-body,
.tools-feed-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Buscador de Explorar (ExploreHeader / _SearchTitleBlock de Alex AI) */
.explore-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  flex-shrink: 0;
}

.explore-search-bar:focus-within {
  border-color: var(--brand-gold);
}

.explore-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}

/* Bloques de sección de Explorar (FeedSection + explore_section_icon.dart de Alex AI) */
.explore-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.explore-section-header {
  display: flex;
  align-items: center;
  gap: 9px;
}

.explore-carousel-nav {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.explore-carousel-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.18s ease;
}

.explore-carousel-btn:hover {
  border-color: var(--brand-gold);
  background: var(--bg-surface-elevated);
  color: var(--brand-gold);
}

.explore-carousel-btn:active {
  transform: scale(0.93);
}

.explore-section-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-gold);
  flex-shrink: 0;
}

body.theme-day .explore-section-icon {
  color: var(--brand-green);
}

.explore-section-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Carrusel horizontal para "Para ti" (como en ExploreFeedScreen de Alex AI) */
.explore-horizontal-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
  min-width: 0;
  width: 100%;
}

.explore-horizontal-row.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
}

.explore-horizontal-row::-webkit-scrollbar {
  height: 6px;
}

.explore-horizontal-row::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.explore-horizontal-row::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 6px;
}

.explore-horizontal-row::-webkit-scrollbar-thumb:hover {
  background: var(--brand-gold);
}

.explore-foryou-card {
  flex: 0 0 245px;
  width: 245px;
  min-width: 245px;
  max-width: 245px;
  scroll-snap-align: start;
  padding: 15px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.explore-foryou-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-gold);
}

.explore-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.explore-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

body.theme-day .explore-badge {
  background: rgba(6, 80, 12, 0.08);
  color: var(--brand-green);
}

.explore-foryou-title {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
}

.explore-foryou-sub {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.explore-card-cta {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Lista vertical de FeedItemCard ("Consultas que pueden ayudarte" / "En tendencia") */
.explore-questions-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.explore-question-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.explore-question-card:hover {
  background: var(--bg-surface-elevated);
  border-color: rgba(255, 255, 255, 0.22);
}

.explore-question-left {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 0;
}

.explore-question-emoji {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.explore-question-info {
  flex: 1;
  min-width: 0;
}

.explore-question-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
}

.explore-question-cat {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Tarjetas de Noticias y Artículos (NewsCard / ArticleDetailScreen de Alex AI) */
.explore-news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.explore-news-card {
  padding: 15px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.explore-news-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.25);
}

.explore-news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.explore-news-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
}

.explore-news-excerpt {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* PESTAÑA 4: TOOLS / HERRAMIENTAS (ToolsScreen / ToolCard de Alex AI) */
.tools-categories-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex-shrink: 0;
}

.tools-categories-row::-webkit-scrollbar {
  height: 0;
}

.tool-cat-chip {
  padding: 7px 13px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.18s ease;
}

.tool-cat-chip.active {
  background: var(--brand-green);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.25);
}

.tools-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-card {
  padding: 16px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 11px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.tool-card:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

.tool-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tool-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-green-soft);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.tool-card-head-info {
  flex: 1;
  min-width: 0;
}

.tool-card-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-top: 3px;
}

.tool-card-desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.tool-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.btn-open-tool {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: var(--brand-green);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.18s ease;
}

.btn-open-tool:hover {
  opacity: 0.92;
}

.btn-ask-tool-chat {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* Estilos para las calculadoras y simuladores interactivos dentro del modal de Tools */
.tool-interactive-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 4px;
}

.tool-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tool-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.tool-field-input,
.tool-field-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.tool-result-panel {
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 13.5px;
  line-height: 1.48;
  color: var(--text-primary);
}

/* ==========================================
   PESTAÑA 5: PERFIL Y CONFIGURACIÓN (CON MODO DÍA/NOCHE Y LUZ AZUL)
   ========================================== */
.perfil-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-green);
  border: 2px solid var(--brand-gold);
  color: #FFFFFF;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-user-info {
  flex: 1;
  min-width: 0;
}

.profile-user-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-user-email {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-outline-small {
  padding: 7px 13px;
  border-radius: 99px;
  border: 1px solid var(--brand-gold);
  background: transparent;
  color: var(--brand-gold);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

body.theme-day .btn-outline-small {
  border-color: var(--brand-green);
  color: var(--brand-green);
}

.btn-outline-small:hover {
  background: var(--brand-gold);
  color: #1E1E1E;
}

.settings-group {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
}

.settings-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-gold);
  padding: 14px 16px 6px;
}

body.theme-day .settings-group-title {
  color: var(--brand-green);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row.clickable {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.settings-row.clickable:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.settings-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.settings-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-green-soft);
  color: var(--brand-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.theme-day .settings-icon {
  color: var(--brand-green);
}

.settings-label-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-label-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Switch estilo Alex AI con verde #06500C y dorado #E8B904 */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

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

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #555;
  border-radius: 34px;
  transition: 0.3s;
}

.switch-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #FFFFFF;
  border-radius: 50%;
  transition: 0.3s;
}

.switch input:checked + .switch-slider {
  background-color: var(--brand-green);
  box-shadow: inset 0 0 0 1.5px var(--brand-gold);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(22px);
  background-color: var(--brand-gold);
}

/* Control deslizante para la intensidad de Luz Azul */
.blue-light-slider-row {
  padding: 4px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand-green) 0%, var(--brand-gold) 100%);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-gold);
  border: 2px solid #FFFFFF;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* ==========================================
   BARRA DE NAVEGACIÓN INFERIOR (BOTTOM NAV BAR)
   ========================================== */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  min-height: 62px;
  height: calc(62px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-nav);
  border-top: 1px solid var(--border-color);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  z-index: 10;
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  transition: color 0.2s ease, transform 0.15s ease;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item.active {
  color: var(--brand-gold);
  font-weight: 700;
}

body.theme-day .nav-item.active {
  color: var(--brand-green);
}

/* ==========================================
   MODALES (NUEVO CHAT, BORRAR HISTORIAL, CONTACTO, LOGIN)
   ========================================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: 22px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  animation: fadeSlideIn 0.25s ease forwards;
}

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

.modal-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
}

.modal-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
}

.modal-input:focus {
  border-color: var(--brand-gold);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.btn-modal-primary {
  flex: 1.4;
  min-height: 44px;
  height: auto;
  padding: 10px 16px;
  border-radius: 99px;
  border: none;
  background: var(--brand-gold);
  color: #1E1E1E;
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

.btn-modal-secondary {
  flex: 0.9;
  min-height: 44px;
  height: auto;
  padding: 10px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

/* ==========================================
   PANTALLAS DE REGISTRO, NOMBRE, COMUNIDAD AUTÓNOMA Y PERFIL (ESTILO ALEX AI)
   ========================================== */
.auth-screen-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 8px 4px;
}

.auth-logo-header .alberto-logo {
  font-size: 34px;
}

.auth-title {
  font-size: clamp(21px, 5.6vw, 25px);
  font-weight: 800;
  line-height: 1.22;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.social-login-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.social-login-stack.compact {
  gap: 8px;
  margin-top: 10px;
}

.btn-social-auth {
  width: 100%;
  height: 48px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.social-login-stack.compact .btn-social-auth {
  height: 42px;
  font-size: 13.5px;
}

.btn-social-auth:hover {
  border-color: var(--brand-gold);
  background: var(--bg-surface-elevated);
}

.btn-social-auth:active {
  transform: scale(0.985);
}

.btn-skip-auth {
  width: 100%;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-skip-auth:hover {
  color: var(--text-primary);
  border-color: var(--brand-gold);
}

.step-form-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 10px 4px;
}

.ccaa-step-content {
  justify-content: flex-start;
  padding-top: 12px;
}

.notif-step-content {
  align-items: flex-start;
}

.step-form-title {
  font-size: clamp(22px, 6vw, 27px);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.step-form-subtitle {
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.step-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.step-text-input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15.5px;
  outline: none;
  transition: border-color 0.2s ease;
}

.step-text-input:focus {
  border-color: var(--brand-gold);
}

.step-input-error {
  font-size: 12.5px;
  color: var(--danger-color);
  font-weight: 500;
}

.ccaa-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  flex-shrink: 0;
}

.ccaa-search-box:focus-within {
  border-color: var(--brand-gold);
}

.ccaa-search-box input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.ccaa-list {
  flex: 1;
  min-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.modal-ccaa-list {
  max-height: 260px;
}

.ccaa-item {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ccaa-item:hover {
  border-color: var(--brand-gold);
}

.ccaa-item.selected {
  background: var(--brand-green);
  border-color: var(--brand-gold);
  color: #FFFFFF;
  font-weight: 700;
}

/* Tarjeta de registro en Perfil cuando el usuario no se ha registrado (unregistered_profile_screen.dart) */
.unregistered-profile-card {
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(6, 80, 12, 0.32) 0%, var(--bg-surface) 85%);
  border: 1px solid rgba(232, 185, 4, 0.38);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.unregistered-card-badge {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-gold);
}

.unregistered-card-title {
  font-size: 16.5px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-primary);
}

.unregistered-card-sub {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.profile-user-stats {
  display: inline-block;
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand-gold);
  background: var(--brand-gold-soft);
  padding: 2px 8px;
  border-radius: 99px;
}

body.theme-day .profile-user-stats {
  color: var(--brand-green);
  background: rgba(6, 80, 12, 0.12);
}

.modal-card-tall {
  max-height: 82vh;
}

.privacy-scroll-body {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.48;
  color: var(--text-secondary);
  padding-right: 4px;
}

/* ==========================================
   REDIMENSIONAMIENTO ADAPTATIVO (MEDIAQUERY / LAYOUTBUILDER DE ALEX AI)
   ========================================== */
@media (max-height: 700px) {
  .onboarding-layer {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .terms-content {
    justify-content: flex-start;
    gap: 10px;
    padding: 4px 2px;
  }
  .terms-badge-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .terms-heading {
    font-size: 21px;
  }
  .terms-card {
    padding: 12px 14px;
    gap: 8px;
  }
  .terms-card p {
    font-size: 13px;
    line-height: 1.4;
  }
  .terms-checkbox-row {
    padding: 10px 12px;
  }
  .btn-gold {
    height: 46px;
    font-size: 15.5px;
  }
  .alex-header,
  .screen-header-large {
    padding: 12px 16px 10px;
  }
  .bottom-nav {
    min-height: 56px;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 360px) {
  .greeting-line-1 {
    font-size: 26px;
  }
  .greeting-line-1 .alberto-logo {
    font-size: 34px;
  }
  .terms-heading {
    font-size: 20px;
  }
  .bubble {
    max-width: 92%;
    font-size: 14.5px;
    padding: 11px 13px;
  }
}
