/* ============================================================
   nous.css — Design System v1.1
   Fonts: DM Serif Display + DM Sans (load via <link> in HTML)
   ============================================================ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --bg:           #ffffff;
  --surface:      #fafafa;
  --border:       #ece8e0;
  --accent:       #d4bc98;
  --accent-dark:  #c9a84c;
  --text:         #1a1a1a;
  --text-muted:   #8a8478;
  --text-light:   #b5b0a5;
  --green:        #6b9b76;
  --sidebar-w:    260px;
  --content-max:  820px;
}

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

html, body {
  height: 100%;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
}

.hidden { display: none !important; }

/* ============================================================
   AUTH PAGE  (index.html)
   ============================================================ */

.auth-split {
  display: flex;
  min-height: 100vh;
}

/* Left — dark panel */
.auth-left {
  width: 50%;
  background: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 56px;
  position: relative;
  overflow: hidden;
}

.auth-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 26px;
  font-style: italic;
  color: #fff;
  letter-spacing: -0.5px;
}

.auth-hero-tag {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.auth-hero-title {
  font-family: 'DM Serif Display', serif;
  font-size: 40px;
  color: #fff;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.auth-hero-sub {
  font-size: 17px;
  color: rgba(255,255,255,0.45);
  font-weight: 300;
  line-height: 1.65;
  max-width: 340px;
}

.auth-user-count {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  font-weight: 300;
}

.auth-user-count span {
  color: var(--accent);
  font-weight: 500;
}

/* Right — form panel */
.auth-right {
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px 56px;
  background: var(--bg);
}

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

.auth-form-title {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 28px;
}

/* Google OAuth button */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}

.btn-google:hover {
  background: var(--surface);
  border-color: var(--text-muted);
}

.btn-google:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-google svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* "o continúa con email" divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider-text {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 300;
  white-space: nowrap;
}

/* Tabs (login / signup) */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.tab {
  flex: 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  padding: 10px 0;
  margin-right: 24px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: var(--text);
  font-weight: 500;
  border-bottom-color: var(--accent-dark);
}

/* Form fields */
.form-field {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-input {
  width: 100%;
  font-size: 16px;
  font-weight: 300;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
  background: #fff;
}

.form-input::placeholder { color: var(--text-light); }

/* Submit button */
#submit-btn,
.btn-primary {
  width: 100%;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  background: var(--text);
  border: none;
  border-radius: 10px;
  padding: 13px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}

#submit-btn:hover,
.btn-primary:hover { background: #2a2a2a; }

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

/* Forgot password link */
.forgot-wrap {
  text-align: right;
  margin: -6px 0 10px;
}
.forgot-link {
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 300;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.forgot-link:hover { color: var(--text); }

/* Auth message */
.message {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 300;
  min-height: 1.2em;
  line-height: 1.5;
}
.message.error   { color: #c0392b; }
.message.success { color: var(--green); }
.message.info    { color: var(--text-muted); }

/* ============================================================
   APP LAYOUT  (app.html)
   ============================================================ */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-header {
  padding: 32px 28px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.app-name {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  font-style: italic;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 6px;
}

.user-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--accent-dark);
  background: #fdf6e8;
  border: 1px solid var(--accent);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  max-width: 204px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  padding: 20px 16px;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 0 12px;
  margin-bottom: 6px;
  margin-top: 20px;
  display: block;
}
.nav-section-label:first-child { margin-top: 0; }

/* Nav items (= app.js's .nav-btn) */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 15px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 2px;
  font-weight: 400;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-btn:hover {
  background: var(--border);
  color: var(--text);
}

.nav-btn.is-active {
  background: var(--accent);
  color: var(--text);
  font-weight: 500;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Logout nav item */
.nav-btn--logout { color: var(--text-muted); }
.nav-btn--logout:hover {
  background: #fdf8f8;
  color: #c0392b;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.current-level-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--text);
  border-radius: 10px;
  cursor: pointer;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.pill-text {
  font-size: 12px;
  color: #fff;
  flex: 1;
  line-height: 1.3;
  min-width: 0;
}

.pill-text strong {
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-text span {
  color: rgba(255,255,255,0.5);
  font-weight: 300;
  font-size: 11px;
}

.pill-arrow {
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Main content column ──────────────────────────────────── */
.main-content {
  height: 100vh;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.main-content > * {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* ── Views ────────────────────────────────────────────────── */
.view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* View topbar */
.view-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  flex-shrink: 0;
}

.view-topbar-title {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 300;
}
.view-topbar-title strong {
  color: var(--text);
  font-weight: 500;
}

.view-topbar-right {
  font-size: 14px;
  color: var(--text-light);
}

/* View body */
.view-body {
  padding: 36px 40px 60px;
  max-width: var(--content-max);
  flex: 1;
}

/* ── Loading ──────────────────────────────────────────────── */
.loading-state {
  display: flex;
  justify-content: center;
  padding: 80px 0;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ============================================================
   HOY VIEW  — Day content
   ============================================================ */

/* Block intro */
.block-intro {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.nivel-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9a84c;
  background: #fdf6e8;
  border: 1px solid #d4bc98;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.dia-titulo {
  font-family: 'DM Serif Display', serif;
  font-size: 30px;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 8px;
}

.pregunta-ancla {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.6;
  margin: 0;
}

/* Bloque navigation (Nivel 1) */
.bloque-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.bloque-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.bloque-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
  background: var(--bg);
}

.bloque-btn.is-active {
  border-color: var(--accent-dark);
  background: #fdf6e8;
  color: var(--accent-dark);
  font-weight: 500;
}

.bloque-btn.locked,
.bloque-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.bloque-btn-num {
  font-weight: 600;
  font-size: 12px;
}

.bloque-btn-titulo {
  font-size: 12px;
}

/* Complete day button */
.btn-complete {
  padding: 10px 20px;
  border: 1.5px solid var(--green);
  border-radius: 8px;
  background: #eef5f0;
  color: var(--green);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-complete:hover:not(:disabled) {
  background: var(--green);
  color: #fff;
}

.btn-complete:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Validate message */
.validate-msg {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 12px;
}

.validate-ok {
  background: #eef5f0;
  color: var(--green);
}

.validate-error {
  background: #fdf0ee;
  color: #c0493a;
}

/* Nivel card complete state */
.nivel-card-complete {
  opacity: 0.7;
}

[data-theme="dark"] .bloque-btn {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
}

[data-theme="dark"] .bloque-btn.is-active {
  background: #2a2410;
  border-color: var(--accent-dark);
  color: var(--accent);
}

[data-theme="dark"] .btn-complete {
  background: #1a2e1e;
  border-color: var(--green);
  color: var(--green);
}

[data-theme="dark"] .validate-ok {
  background: #1a2e1e;
  color: var(--green);
}

[data-theme="dark"] .validate-error {
  background: #2e1a1a;
  color: #e07060;
}

/* Day navigation */
.day-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.day-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  min-width: 58px;
  transition: border-color 0.15s, background 0.15s;
}

.day-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.day-btn.is-active {
  background: var(--text);
  border-color: var(--text);
}

.day-btn.is-active .day-btn-num {
  color: var(--accent);
}

.day-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.day-btn-num {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-btn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.day-btn.completed .day-btn-dot { background: var(--green); }
.day-btn.is-active .day-btn-dot { background: var(--accent); }
.day-btn.available .day-btn-dot { background: var(--text-light); }

/* 2-pill day nav */
.day-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-radius: 14px;
  padding: 12px 8px;
  border: 1px solid transparent;
  font-family: inherit;
  cursor: default;
}
.day-card--active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.day-card--next {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--text-light);
}
.day-card-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.day-card--active .day-card-label { opacity: 0.8; }
.day-card-num {
  font-size: 18px;
  font-weight: 500;
}
.day-card--next .day-card-num { font-weight: 400; }
.day-card-lock {
  font-size: 14px;
  margin-top: 2px;
}

/* Content tabs */
.ctabs-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.ctab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  padding: 12px 0;
  margin-right: 28px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.ctab:hover { color: var(--text); }

.ctab.is-active {
  color: var(--text);
  font-weight: 500;
  border-bottom-color: var(--accent-dark);
}

.ia-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  margin-left: 5px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}
.ia-badge.hidden { display: none; }

.ctab-panel { animation: fadeUp 0.15s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* Lectura */
.lectura-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 24px;
}

.lectura-text {
  font-size: 17px;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.8;
  margin: 0;
  white-space: pre-wrap;
}

/* Practice */
.pregunta-practica-text {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  letter-spacing: -0.3px;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 8px;
}

.practica-hint,
.instruccion-practica-text {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 300;
  margin-bottom: 20px;
  line-height: 1.6;
}

.practice-textarea {
  width: 100%;
  max-width: 580px;
  min-height: 160px;
  font-size: 15px;
  font-weight: 300;
  color: var(--text);
  line-height: 1.7;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.practice-textarea:focus {
  border-color: var(--accent);
  background: #fff;
}

.practice-textarea::placeholder { color: var(--text-light); }

.practice-counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  margin-bottom: 16px;
  max-width: 580px;
  gap: 8px;
}

.practice-counter-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.char-counter {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-light);
  transition: color 0.2s;
}
.char-counter.warning { color: var(--accent-dark); }
.char-counter.ready   { color: var(--green); }

.save-indicator {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
}

.btn-save-inline {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-dark);
  background: #fdf6e8;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-save-inline:hover { background: #fbefd4; }

.practice-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

/* "¿Qué has descubierto?" button — gold IA style */
button.primary,
#go-to-ia-btn {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-dark);
  background: #fdf6e8;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-start;
}
button.primary:hover,
#go-to-ia-btn:hover { background: #fbefd4; }
button.primary:disabled,
#go-to-ia-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Chat */
.chat-welcome {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
}
.chat-welcome p { margin: 0; }

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  padding: 0 0 8px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-bubble {
  max-width: 82%;
  padding: 13px 16px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble--user {
  align-self: flex-end;
  background: var(--text);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Wrapper for assistant messages: holds sender label + bubble */
.chat-msg-wrap {
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  max-width: 82%;
}

.bubble-sender {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
  padding-left: 3px;
}

.chat-bubble--assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* Inside the wrapper, bubble fills its width */
.chat-msg-wrap .chat-bubble--assistant {
  align-self: stretch;
  max-width: none;
}

.chat-bubble.loading {
  color: var(--text-muted);
  font-style: italic;
}

.chat-day-sep {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin: 20px 0 12px;
  position: relative;
}

.chat-day-sep::before,
.chat-day-sep::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: var(--border);
}

.chat-day-sep::before { left: 0; }
.chat-day-sep::after  { right: 0; }

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 12px 12px 16px;
  max-width: 580px;
  transition: border-color 0.2s;
}
.chat-input-wrap:focus-within { border-color: var(--accent); }

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 15px;
  font-weight: 300;
  color: var(--text);
  line-height: 1.5;
  resize: none;
  outline: none;
  padding: 0;
  max-height: 120px;
  overflow-y: auto;
}
.chat-input::placeholder { color: var(--text-light); }

.send-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  background: var(--text);
  border: none;
  border-radius: 10px;
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.send-btn:hover { background: #2a2a2a; }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.chat-limit-msg {
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* Mapa de Comportamiento */
.mapa-wrap {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mapa-btn {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-dark);
  background: #fdf6e8;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.mapa-btn:hover { background: #fbefd4; }
.mapa-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.mapa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 14px;
  padding: 20px 24px;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.7;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.mapa-card-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 12px;
}

/* ============================================================
   PROGRESO VIEW
   ============================================================ */

.view-body--progreso {
  padding-top: 0;
}

/* Summary strip */
.summary-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 36px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
}

.summary-card.highlight {
  background: var(--text);
  border-color: var(--text);
}

.summary-num {
  font-family: 'DM Serif Display', serif;
  font-size: 34px;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.summary-card.highlight .summary-num  { color: var(--accent); }
.summary-card.highlight .summary-label { color: rgba(255,255,255,0.45); }

.summary-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 300;
}

/* Section header */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
}

/* Level accordion */
.level-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.level-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}

.level-item.active-level  { border-color: var(--accent-dark); }
.level-item.locked-level  { opacity: 0.4; }

.level-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}

.locked-level .level-header { cursor: default; }

.level-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.dot-done   { background: var(--green);  color: #fff; }
.dot-active { background: var(--text);   color: var(--accent); }
.dot-locked { background: var(--border); color: var(--text-light); }

.level-header-info { flex: 1; min-width: 0; }

.level-num-tag {
  font-size: 10px;
  color: var(--text-light);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1px;
}

.level-name {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
}

.level-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

/* Inline progress bar */
.inline-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-bar {
  width: 80px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.inline-fill  { height: 100%; border-radius: 2px; }
.fill-done    { background: var(--green); }
.fill-active  { background: var(--accent-dark); }

.inline-text {
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
}

/* Level status badges (progress accordion) */
.level-status-badge {
  font-size: 13px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.level-status-badge.badge-done-lv   { background: #eef5f0; color: var(--green); }
.level-status-badge.badge-active-lv { background: #fdf6e8; color: var(--accent-dark); }
.level-status-badge.badge-locked-lv { background: var(--border); color: var(--text-light); }

.level-chevron {
  font-size: 12px;
  color: var(--text-light);
  transition: transform 0.2s;
}

.level-item.open .level-chevron { transform: rotate(180deg); }

/* Blocks panel */
.blocks-panel {
  display: none;
  padding: 16px 20px 20px;
  background: var(--bg);
}

.level-item.open .blocks-panel { display: block; }

.panel-desc {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 300;
  margin-bottom: 12px;
}

/* Blocks grid (Nivel 1+) */
.blocks-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.block-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface);
  position: relative;
}

.block-card.b-done   { border-color: var(--green); }
.block-card.b-active { border-color: var(--accent-dark); }
.block-card.b-locked { opacity: 0.5; }

.block-num {
  font-size: 10px;
  color: var(--text-light);
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.block-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.block-days {
  margin-top: 8px;
}

.block-days .dp-pct-label {
  font-size: 11px;
}

.block-status-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 12px;
}

/* Days progress bar (Etapa 0) */
.days-progress {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.dp-track {
  height: 8px;
  border-radius: 4px;
  background: #ece8e0;
  overflow: hidden;
}

.dp-fill {
  height: 8px;
  border-radius: 4px;
  background: #6b9b76;
  transition: width 0.3s ease;
}

.dp-pct-label {
  margin-top: 6px;
  text-align: right;
  font-size: 12px;
  color: #8a8478;
}

/* Dark mode */
[data-theme="dark"] .summary-card.highlight { background: #1a1a18; border-color: #2a2a27; }
[data-theme="dark"] .blocks-panel { background: var(--bg); }
[data-theme="dark"] .block-card { background: var(--surface); }

/* Legacy day-status badges (used in nivel0/1 day nav) */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
}

.badge-completed { background: #eef5f0; color: var(--green); }
.badge-available { background: #fdf6e8; color: var(--accent-dark); }
.badge-locked    { background: var(--border); color: var(--text-light); }

/* ============================================================
   NIVELES VIEW
   ============================================================ */

.niveles-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* New level-card design matching mockup */
.level-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.level-card:hover:not(.locked) {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(212,188,152,0.15);
}

.level-card.locked {
  opacity: 0.45;
  cursor: default;
}

.level-card.active-card-grid {
  border-color: var(--accent-dark);
}

.level-card.completed {
  border-color: var(--green);
}

.card-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.card-dot.done        { background: var(--green); color: #fff; }
.card-dot.active-dot  { background: var(--text); color: var(--accent); }
.card-dot.locked-dot  { background: var(--border); color: var(--text-light); }

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

.card-level-num {
  font-size: 10px;
  color: var(--text-light);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.card-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-frase {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 300;
  font-style: italic;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-sub {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 300;
}

.card-status {
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}

.card-status.done     { color: var(--green); }
.card-status.active-s { color: var(--accent-dark); }
.card-status.locked-s { color: var(--text-light); }

/* Dark mode */
[data-theme="dark"] .level-card { background: var(--surface); }
[data-theme="dark"] .card-dot.active-dot { background: var(--text); color: var(--accent); }

/* Legacy nivel-card (kept for any remaining references) */
.nivel-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 10px;
}

.nivel-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(212,188,152,0.15);
}

.nivel-card-body { display: flex; flex-direction: column; gap: 4px; }

.nivel-card-titulo {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

.nivel-card-desc {
  font-size: 15px;
  font-weight: 300;
  color: var(--text-muted);
  margin: 0;
}

.nivel-card-arrow {
  font-size: 18px;
  color: var(--text-light);
}

/* ============================================================
   AJUSTES VIEW
   ============================================================ */

.settings-group {
  margin-bottom: 28px;
}

.group-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 10px;
  padding-left: 2px;
}

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }

.setting-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

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

.setting-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.setting-sub {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 300;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
  background: #fdf8f8;
  border: 1px solid #f0d0d0;
  border-radius: 16px;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
  margin-bottom: 10px;
}
.danger-row:hover { background: #faeaea; }

.danger-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fce8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.danger-label {
  font-size: 15px;
  font-weight: 500;
  color: #c0392b;
}

.danger-sub {
  font-size: 13px;
  color: #e08080;
  font-weight: 300;
}

.version-note {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 300;
  margin-top: 24px;
  text-align: center;
}

.version-note span { color: var(--accent-dark); }

/* ============================================================
   DARK MODE
   ============================================================ */

[data-theme="dark"] {
  --bg:          #111110;
  --surface:     #1a1a18;
  --border:      #2a2a27;
  --accent:      #d4bc98;
  --accent-dark: #c9a84c;
  --text:        #f0ede8;
  --text-muted:  #8a8478;
  --text-light:  #4a4a45;
  --green:       #6b9b76;
}

html, body {
  transition: background 0.3s, color 0.3s;
}

[data-theme="dark"] .danger-row {
  background: #1e1414;
  border-color: #3a2020;
}
[data-theme="dark"] .danger-row:hover { background: #251616; }
[data-theme="dark"] .danger-icon { background: #3a1e1e; }
[data-theme="dark"] .user-badge { background: #2a2410; }

/* ============================================================
   AJUSTES — additional controls
   ============================================================ */

.setting-input {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  width: 150px;
  outline: none;
  text-align: right;
  transition: border-color 0.2s;
  flex-shrink: 0;
}
.setting-input:focus { border-color: var(--accent); }

.ia-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ia-name-save {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.ia-name-save:hover               { border-color: var(--accent); color: var(--text); }
.ia-name-save:disabled            { opacity: 0.5; cursor: default; }
.ia-name-save.ia-saved            { border-color: var(--green);  color: var(--green); }
.ia-name-save.ia-error            { border-color: #e05252;       color: #e05252; }

.setting-select {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  width: 160px;
  outline: none;
  cursor: pointer;
  appearance: none;
  text-align: right;
  transition: border-color 0.2s;
  flex-shrink: 0;
}
.setting-select:focus { border-color: var(--accent); }

/* Theme toggle buttons */
.theme-options {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.theme-btn.active {
  background: var(--text);
  color: var(--accent);
  border-color: var(--text);
}

.theme-btn:not(.active):hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Notification toggle */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.toggle-label-text {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 300;
}

.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 13px;
  transition: background 0.25s;
}

.toggle input:checked + .toggle-track { background: var(--text); }

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: transform 0.25s;
}

.toggle input:checked ~ .toggle-thumb { transform: translateX(18px); }

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 28px;
}

/* ============================================================
   RAÍZ VIEW
   ============================================================ */

/* Topbar progress bar */
.raiz-topbar-bar {
  width: 80px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.raiz-topbar-fill {
  height: 100%;
  background: var(--accent-dark);
  border-radius: 2px;
  transition: width 0.3s ease;
}

#raiz-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-light);
}

/* Intro */
.raiz-intro {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.raiz-intro-title {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 8px;
}

.raiz-intro-sub {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.6;
  max-width: 520px;
}

/* Section card */
.section-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--surface);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.section-head:hover { background: #f5f2ec; }
[data-theme="dark"] .section-head:hover { background: rgba(255,255,255,0.04); }

.section-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.num-complete { background: var(--green); color: #fff; }
.num-partial  { background: #fdf6e8; color: var(--accent-dark); border: 1px solid var(--accent); }
.num-empty    { background: var(--border); color: var(--text-light); }

[data-theme="dark"] .num-partial { background: #2a2410; }

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

.section-name {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.section-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-bar {
  width: 80px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.section-fill { height: 100%; border-radius: 2px; }
.fill-green { background: var(--green); }
.fill-gold  { background: var(--accent-dark); }
.fill-gray  { width: 0; }

.section-count {
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
}

.section-badge {
  font-size: 13px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-complete { background: #eef5f0; color: var(--green); }
.badge-partial  { background: #fdf6e8; color: var(--accent-dark); }
.badge-empty    { background: var(--border); color: var(--text-light); }

[data-theme="dark"] .badge-partial { background: #2a2410; }

.section-chevron {
  font-size: 11px;
  color: var(--text-light);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.section-card.open .section-chevron { transform: rotate(180deg); }

/* Questions panel */
.questions-panel {
  display: none;
  border-top: 1px solid var(--border);
}

.section-card.open .questions-panel { display: block; }

.question-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: background 0.15s;
}

.question-row:last-child { border-bottom: none; }
.question-row:hover { background: #fdf9f5; }

[data-theme="dark"] .question-row:hover { background: rgba(255,255,255,0.02); }

.question-row.answered { cursor: default; }
.question-row.answered:hover { background: var(--bg); }

.q-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 7px;
}

.q-done  { background: var(--green); }
.q-empty { background: var(--border); }

.q-body { flex: 1; min-width: 0; }

.q-text {
  font-size: 16px;
  color: var(--text);
  font-weight: 300;
  line-height: 1.5;
  margin-bottom: 10px;
}

.q-answer {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.6;
  background: var(--surface);
  border-left: 2px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.q-edit-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-dark);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.q-edit-btn:hover { text-decoration: underline; }

.q-answer-hint {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 300;
}

/* Write overlay */
.raiz-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.raiz-modal {
  background: var(--bg);
  border-radius: 20px;
  width: 560px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
}

.modal-section-tag {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 12px;
}

.modal-question {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  letter-spacing: -0.3px;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 24px;
}

.modal-textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 300;
  color: var(--text);
  line-height: 1.6;
  resize: vertical;
  outline: none;
  background: var(--surface);
  transition: border-color 0.2s;
  margin-bottom: 10px;
}

.modal-textarea:focus { border-color: var(--accent); }
.modal-textarea::placeholder { color: var(--text-light); }

.modal-hint {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 300;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-cancel {
  font-size: 15px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: color 0.15s;
}
.modal-cancel:hover { color: var(--text); }

.modal-save {
  background: var(--text);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-save:hover { background: #2a2a2a; }
[data-theme="dark"] .modal-save { color: var(--accent); }

/* ============================================================
   LEGAL — auth notice + app footer
   ============================================================ */

.auth-legal {
  margin: 12px 0 0;
  font-size: 12px;
  color: #999;
  text-align: center;
  line-height: 1.5;
}
.auth-legal a {
  color: #888;
  text-decoration: underline;
  text-decoration-color: #ccc;
}
.auth-legal a:hover { color: #555; }

.legal-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted, #aaa);
  background: var(--bg, #fff);
  border-top: 1px solid var(--border, #eee);
  z-index: 10;
}
.legal-footer a {
  color: var(--text-muted, #aaa);
  text-decoration: none;
}
.legal-footer a:hover { color: var(--text-light, #666); }
.legal-sep { opacity: 0.5; }

/* ============================================================
   RESPONSIVE — narrow viewports
   ============================================================ */
@media (max-width: 900px) {
  .auth-split { flex-direction: column; }
  .auth-left, .auth-right { width: 100%; }
  .auth-left { padding: 40px 32px; min-height: 260px; }
  .auth-right { padding: 40px 32px; }
  .auth-hero-title { font-size: 28px; }
}

/* ============================================================
   MOBILE APP LAYOUT  (≤ 767px)
   ============================================================ */

/* Hidden by default on desktop */
/* ── Delete account button ─────────────────────────────────────────────────── */
.delete-account-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
  background: #fff5f5;
  border: 1px solid #f0d0d0;
  border-radius: 16px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  margin-top: 8px;
  transition: background 0.15s;
}
.delete-account-row:hover { background: #faeaea; }

/* ── Delete account confirmation modal ─────────────────────────────────────── */
.delete-modal {
  text-align: center;
  padding: 40px 36px;
  max-width: 360px;
}
.delete-modal-icon  { font-size: 36px; margin-bottom: 14px; }
.delete-modal-title {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-bottom: 10px;
}
.delete-modal-body {
  font-size: 15px;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}
.delete-confirm-btn {
  background: #d93535;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.delete-confirm-btn:hover    { background: #b82c2c; }
.delete-confirm-btn:disabled { opacity: 0.6; cursor: default; }

.mob-header,
.mob-nav { display: none; }

@media (max-width: 767px) {

  /* Collapse sidebar column */
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .legal-footer { display: none; }

  /* ── Fixed mobile header ─────────────────────────────────── */
  .mob-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    inset: 0 0 auto 0;
    height: 52px;
    padding: 0 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 200;
    /* top transition instead of transform — avoids iOS Chrome stacking-context bug
       with position:fixed + transform on the same element */
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .mob-header.chrome-hidden { top: -52px; }

  .mob-header-title {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    font-style: italic;
    letter-spacing: -0.5px;
    color: var(--text);
  }

  .mob-header-user {
    font-size: 12px;
    color: var(--accent-dark);
    background: #fdf6e8;
    border: 1px solid var(--accent);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── Fixed mobile bottom nav ─────────────────────────────── */
  .mob-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    inset: auto 0 0 0;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 200;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .mob-nav.chrome-hidden { bottom: -100px; }

  .mob-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 400;
    padding: 6px 8px;
    cursor: pointer;
    transition: color 0.15s;
    font-family: inherit;
    min-width: 52px;
  }

  .mob-nav-icon { font-size: 20px; line-height: 1; }

  .mob-nav-btn.is-active {
    color: var(--accent-dark);
    font-weight: 600;
  }

  /* ── Content area offsets ────────────────────────────────── */
  /* 52px mob-header + 52px view-topbar = 104px total */
  .main-content {
    height: 100vh;   /* fallback */
    height: 100svh;  /* excludes dynamic Chrome iOS toolbar — prevents scroll container overflow */
    padding-top: 104px;
    padding-bottom: 60px;
    transition: padding-top 0.3s ease, padding-bottom 0.3s ease;
    -webkit-overflow-scrolling: touch;
  }

  /* view-topbar: fixed (not sticky) so it stays pinned below mob-header
     regardless of overflow-y:auto on .main-content */
  .view-topbar {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    height: 52px;
    padding: 0 20px;
    z-index: 100;
    background: var(--bg);
    transition: top 0.3s ease;
  }

  /* ── Ajustes: nombre IA — stack vertically on mobile ────────── */
  .ia-name-row.setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .ia-name-row .ia-name-wrap {
    width: 100%;
  }
  .ia-name-row .setting-input {
    flex: 1;
    width: auto;
    text-align: left;
    min-width: 0;
  }

  /* ── Ajustes: tema — wrap buttons on mobile ─────────────────── */
  .theme-options {
    flex-wrap: wrap;
    max-width: 100%;
  }
  .theme-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }

  .days-progress { border-top: none; }

  /* ── Chat IA: scroll natural, input sticky ─────────────────────── */
  #chat-messages {
    max-height: none;
    overflow-y: visible;
  }

  #tab-ia {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  #tab-ia .chat-input-wrap {
    max-width: none;
  }
}
