/* ============================================================
   Leo y Compañía — estilos de los paneles de adultos
   Paleta: verde bosque / crema / azul suave. Cálido y profesional.
   ============================================================ */

:root {
  --verde: #3e7c4f;
  --verde-oscuro: #2e5e3b;
  --verde-claro: #e3f0e6;
  --crema: #faf6ee;
  --crema-oscuro: #f1e9d8;
  --azul: #4a7fa5;
  --azul-claro: #e4eef5;
  --ambar: #b97a1e;
  --ambar-claro: #fdf1dc;
  --rojo-suave: #b8524a;
  --tinta: #2c3630;
  --tinta-suave: #6b756e;
  --blanco: #ffffff;
  --borde: #e3ddcf;
  --radio: 16px;
  --sombra: 0 2px 10px rgba(44, 54, 48, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--crema);
  color: var(--tinta);
  line-height: 1.55;
}

h1, h2, h3, h4 { line-height: 1.2; color: var(--tinta); }
h1 { font-size: 1.9rem; margin: 0.4em 0; }
h2 { font-size: 1.3rem; margin: 0.3em 0 0.6em; }
h3 { font-size: 1.05rem; margin: 0.3em 0; }

a { color: var(--azul); }
a:hover { color: var(--verde-oscuro); }

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 1.2rem 1rem 3rem;
}

.muted { color: var(--tinta-suave); font-size: 0.92rem; margin: 0.2em 0; }
.mt-2 { margin-top: 1.2rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Cabecera y navegación ---------- */
.site-header {
  background: var(--blanco);
  border-bottom: 1px solid var(--borde);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--verde-oscuro);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.brand-mark { font-size: 1.4rem; }
.nav-links { display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; }
.nav-link {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--tinta);
  font-weight: 600;
  font-size: 0.95rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.nav-link:hover { background: var(--verde-claro); color: var(--verde-oscuro); }
.nav-link.active { background: var(--verde-claro); color: var(--verde-oscuro); }
.nav-button { color: var(--tinta-suave); }
form:has(> .nav-button) { display: inline; }

/* ---------- Flashes ---------- */
.flash {
  max-width: 1060px;
  margin: 0.8rem auto 0;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radio);
  font-weight: 500;
}
.flash ul { margin: 0.3em 0 0; padding-left: 1.2em; }
.flash-notice { background: var(--verde-claro); color: var(--verde-oscuro); border: 1px solid #c4dfcb; }
.flash-alert { background: var(--ambar-claro); color: var(--ambar); border: 1px solid #ecd9b4; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1.2rem 1.4rem;
  margin: 0.8rem 0;
}
.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.empty-state { text-align: center; padding: 2rem; color: var(--tinta-suave); }

/* ---------- Botones ---------- */
.btn {
  display: inline-block;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 2px solid transparent;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--verde); color: var(--blanco); }
.btn-primary:hover { background: var(--verde-oscuro); color: var(--blanco); }
.btn-secondary { background: var(--azul-claro); color: var(--azul); border-color: var(--azul-claro); }
.btn-secondary:hover { background: #d3e3ef; color: var(--azul); }
.btn-play { background: #f4a83d; color: #5b3c00; }
.btn-play:hover { background: #eb9a25; color: #5b3c00; }
.btn-ghost { background: transparent; color: var(--tinta-suave); border-color: var(--borde); }
.btn-ghost:hover { background: var(--crema-oscuro); }
.btn-danger { background: var(--rojo-suave); color: var(--blanco); }
.btn-lg { padding: 0.75rem 1.6rem; font-size: 1.05rem; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.85rem; }

/* ---------- Landing ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2.5rem 0 1.5rem;
  flex-wrap: wrap;
}
.hero-copy { flex: 1 1 420px; }
.hero h1 { font-size: 2.4rem; margin: 0.2em 0; color: var(--verde-oscuro); }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--azul);
  margin: 0;
}
.lead { font-size: 1.1rem; color: var(--tinta-suave); }
.hero-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.2rem; }
.hero-art {
  flex: 0 1 280px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.hero-emoji {
  font-size: 3rem;
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  display: grid;
  place-items: center;
  aspect-ratio: 1;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.feature h3 { margin-top: 0; }
.cta-strip { text-align: center; padding: 2rem; background: var(--azul-claro); border-color: #cfe0ec; }

/* ---------- Paneles ---------- */
.panel-intro { margin: 1rem 0 0.5rem; }
.child-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.child-card { display: block; text-decoration: none; color: inherit; transition: transform 0.1s ease; }
.child-card:hover { transform: translateY(-2px); border-color: var(--verde); }
.child-card-head { display: flex; align-items: center; gap: 0.8rem; }
.child-card-head h3 { margin: 0; }
.child-card-stats { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.8rem; }
.stat { font-size: 0.92rem; }

.avatar {
  font-size: 2rem;
  background: var(--verde-claro);
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.avatar-lg { font-size: 2.6rem; width: 4rem; height: 4rem; }
.avatar-sm { font-size: 1.1rem; width: 1.8rem; height: 1.8rem; vertical-align: middle; }

.child-header { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.child-header h1 { margin: 0; }
.child-header-actions { margin-left: auto; }

.trend-mejorando { color: var(--verde-oscuro); }
.trend-necesita_apoyo { color: var(--ambar); }
.trend-estable { color: var(--tinta-suave); }

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  align-items: start;
}

/* ---------- Las 5 barras ---------- */
.bars { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.8rem; }
.bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  background: var(--crema);
  border: 1px solid var(--borde);
}
.bar-symbol { font-size: 1.2rem; line-height: 1; }
.bar-block { font-weight: 700; flex: 1; }
.bar-level { font-size: 0.85rem; color: var(--tinta-suave); }
.bar-conseguido { background: var(--verde-claro); border-color: #c4dfcb; }
.bar-conseguido .bar-symbol { color: var(--verde); }
.bar-progresando { background: var(--azul-claro); border-color: #cfe0ec; }
.bar-progresando .bar-symbol { color: var(--azul); }
.bar-empezando .bar-symbol { color: var(--tinta-suave); }

.bars-compact { flex-direction: row; gap: 0.3rem; flex-wrap: wrap; margin-top: 0; }
.bars-compact .bar { padding: 0.2rem 0.55rem; gap: 0.35rem; border-radius: 999px; }
.bars-compact .bar-block { font-size: 0.78rem; font-weight: 600; }
.bars-compact .bar-symbol { font-size: 0.9rem; }

/* ---------- Fortalezas / cariño ---------- */
.strengths-card { border-top: 4px solid var(--verde); }
.care-card { border-top: 4px solid var(--ambar); }
.skill-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.3rem; }
.chip {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--borde);
  background: var(--crema);
  color: var(--tinta);
}
.chip-green { background: var(--verde-claro); color: var(--verde-oscuro); border-color: #c4dfcb; }
.chip-amber { background: var(--ambar-claro); color: var(--ambar); border-color: #ecd9b4; }
.chip-active { background: var(--verde); color: var(--blanco); border-color: var(--verde); }
.suggestion { font-size: 0.9rem; color: var(--tinta-suave); margin: 0.4em 0 0; font-style: italic; }
.gentle-flag { background: var(--ambar-claro); border-color: #ecd9b4; }
.gentle-flag p { margin: 0.2em 0; }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
.stat-card { text-align: center; }
.stat-big { display: block; font-size: 2rem; font-weight: 800; color: var(--verde-oscuro); }
.stat-label { font-size: 0.85rem; color: var(--tinta-suave); }

.fine-print { font-size: 0.85rem; color: var(--tinta-suave); margin-top: 1.4rem; }

/* ---------- Formularios ---------- */
.form-card h2 { margin-top: 0; }
.field { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.field-inline { flex-direction: row; align-items: center; gap: 0.5rem; }
.field label, .field legend { font-weight: 600; font-size: 0.95rem; }
.hint { font-size: 0.82rem; color: var(--tinta-suave); margin: 0.1em 0 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  padding: 0.6rem 0.8rem;
  border: 1.5px solid var(--borde);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--blanco);
  color: var(--tinta);
  max-width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--verde);
  outline-offset: 1px;
  border-color: var(--verde);
}
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; accent-color: var(--verde); }
fieldset { border: none; padding: 0; margin: 0 0 1rem; }
.select-sm { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
.inline-form { display: flex; gap: 0.4rem; align-items: center; }

.avatar-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.5rem; }
.avatar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem;
  border: 2px solid var(--borde);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.8rem;
}
.avatar-option:has(input:checked) { border-color: var(--verde); background: var(--verde-claro); }
.avatar-option input { position: absolute; opacity: 0; }
.avatar-name { color: var(--tinta-suave); }

/* ---------- Controles parentales ---------- */
.allow-group { margin-bottom: 1rem; }
.allow-group legend { color: var(--verde-oscuro); font-size: 1rem; margin-bottom: 0.4rem; }
.allow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.5rem; }
.allow-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--borde);
  border-radius: 10px;
  cursor: pointer;
  background: var(--crema);
}
.allow-option:has(input:checked) { border-color: var(--verde); background: var(--verde-claro); }
.allow-dot { width: 0.9rem; height: 0.9rem; border-radius: 50%; flex-shrink: 0; }
.character-option { flex-direction: column; text-align: center; }
.character-img { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; }
.sticky-actions {
  position: sticky;
  bottom: 0.8rem;
  text-align: center;
  padding: 0.6rem;
  z-index: 5;
}

.consent-card { border-top: 4px solid var(--azul); }
.consent-list { list-style: none; padding: 0; margin: 0; }
.consent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--borde);
  flex-wrap: wrap;
}
.consent-item:last-child { border-bottom: none; }
.consent-info { display: flex; flex-direction: column; gap: 0.15rem; }
.consent-state { font-size: 0.85rem; color: var(--tinta-suave); }
.consent-state.granted { color: var(--verde-oscuro); }
.consent-state.denied { color: var(--rojo-suave); }
.consent-actions { display: flex; gap: 0.4rem; }

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tinta-suave);
  padding: 0.5rem 0.6rem;
  border-bottom: 2px solid var(--borde);
}
.table td { padding: 0.6rem; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }
.row-priority { background: var(--ambar-claro); }
.student-id { font-size: 0.75rem; color: var(--tinta-suave); }
.join-code { font-size: 0.95rem; letter-spacing: 0.05em; }
.join-code-big { letter-spacing: 0.12em; color: var(--verde-oscuro); }

/* ---------- Ciencia ---------- */
.search-form { display: flex; gap: 0.5rem; margin: 1rem 0; }
.search-input { flex: 1; }
.science-area { margin-top: 1.5rem; }
.area-title { color: var(--verde-oscuro); border-bottom: 2px solid var(--verde-claro); padding-bottom: 0.3rem; }
.category-title { color: var(--tinta-suave); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 1rem 0 0.4rem; }
.science-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.8rem; }
.science-card { display: block; text-decoration: none; color: inherit; margin: 0; }
.science-card:hover { border-color: var(--verde); transform: translateY(-2px); }
.science-card h4 { margin: 0 0 0.4rem; color: var(--verde-oscuro); }
.read-more { font-size: 0.85rem; font-weight: 700; color: var(--azul); }
.science-entry { max-width: 720px; margin: 0 auto; }
.science-section h2 { font-size: 1.1rem; margin-top: 0; }
.highlight-section { border-left: 4px solid var(--verde); }
.breadcrumb { font-size: 0.9rem; }
.science-missing { padding: 3rem 1rem; }

/* ---------- Admin ---------- */
.admin-stats { margin-bottom: 1rem; }
.filter-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin: 0.8rem 0; }
.role-admin, .role-super_admin { background: var(--azul-claro); color: var(--azul); }
.role-teacher { background: var(--verde-claro); color: var(--verde-oscuro); }
.status-published { background: var(--verde-claro); color: var(--verde-oscuro); }
.status-draft { background: var(--crema-oscuro); color: var(--tinta-suave); }

/* ---------- Auth ---------- */
.auth-card { max-width: 460px; margin: 2rem auto; }
.auth-links { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 1rem; font-size: 0.92rem; }

/* ---------- Pie ---------- */
.site-footer {
  border-top: 1px solid var(--borde);
  background: var(--blanco);
  text-align: center;
  padding: 1.2rem 1rem;
  color: var(--tinta-suave);
  font-size: 0.88rem;
}

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .hero h1 { font-size: 1.8rem; }
  .hero { padding-top: 1.2rem; }
  .card { padding: 1rem; }
  .child-header-actions { margin-left: 0; width: 100%; }
  .consent-item { flex-direction: column; align-items: flex-start; }
  .nav { justify-content: center; }
}

/* Gestión de peques (panel de familia) */
.child-cell { display: flex; flex-direction: column; }
.child-manage { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .5rem .2rem 0; }
.btn-mini { font-size: .85rem; padding: .35rem .7rem; border-radius: 10px; }
.btn-danger { background: #fdecec; color: #b3261e; border: 1px solid #f4c7c3; }
.btn-danger:hover { background: #f9d7d5; }
.inline-edit { position: relative; }
.inline-edit > summary { list-style: none; cursor: pointer; }
.inline-edit .mini-form { position: absolute; z-index: 20; margin-top: .4rem; background: #fff; border: 1px solid #e3e0d8;
  border-radius: 14px; padding: .8rem; box-shadow: 0 10px 26px rgba(0,0,0,.12); width: 230px; display: flex; flex-direction: column; gap: .5rem; }
.inline-edit .mini-form label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: #5b6b5f; font-weight: 700; }
.inline-edit .mini-form input, .inline-edit .mini-form select { padding: .4rem; border: 1px solid #d8d3c8; border-radius: 8px; font-size: .95rem; }

/* Avatares con imagen (personajes generados) */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .5rem; max-height: 320px; overflow-y: auto; }
.avatar-option .avatar { width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; font-size: 2rem; margin: 0 auto; }
.child-card-head .avatar { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; font-size: 2rem; }
