/* ==========================================================================
   KUSIMIKHUY — SISTEMA DE DISEÑO ACADÉMICO v2.0
   Blueprint v1.0 — Paleta Agrobiodiversidad Andina
   Fuente: Montserrat | Iconos: Material Symbols (Google)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

/* ===== TOKENS DE DISEÑO ===== */
:root {
  /* Paleta Institucional (Blueprint v1.0) */
  --color-primary:       #065F46;   /* Verde Esmeralda — Identidad y vida */
  --color-primary-hover: #047857;
  --color-primary-light: #D1FAE5;
  --color-secondary:     #D97706;   /* Dorado Granos Andinos (Quinua/Kiwicha) */
  --color-secondary-light: #FEF3C7;
  --color-danger:        #DC2626;   /* Rojo Carmín — Alerta de anemia */
  --color-danger-light:  #FEE2E2;
  --color-warning:       #F59E0B;
  --color-warning-light: #FFFBEB;
  --color-info:          #2563EB;
  --color-info-light:    #DBEAFE;

  /* Superficies y Fondos */
  --color-bg:            #F1F5F9;   /* Fondo de página */
  --color-surface:       #FFFFFF;   /* Tarjetas, paneles */
  --color-surface-alt:   #F8FAFC;   /* Filas alternas de tabla */
  --color-sidebar:       #1E293B;   /* Barra lateral, footer */

  /* Texto */
  --color-text:          #1E293B;   /* Texto principal */
  --color-text-muted:    #64748B;   /* Texto secundario */
  --color-text-light:    #94A3B8;   /* Placeholders */
  --color-text-inverse:  #FFFFFF;

  /* Bordes y Sombras */
  --color-border:        #E2E8F0;
  --color-border-dark:   #CBD5E1;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 10px 15px rgba(0,0,0,0.07), 0 4px 6px rgba(0,0,0,0.05);

  /* Tipografía */
  --font-base: 'Montserrat', sans-serif;
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;

  /* Espaciados y Radios */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-full: 9999px;
}

/* ===== RESET BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-base);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  font-size: var(--text-base);
  min-height: 100vh;
}

/* ===== TIPOGRAFÍA ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-base);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
  color: var(--color-text);
  line-height: 1.65;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* ===== LAYOUT GENERAL ===== */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.page-content {
  padding-top: 28px;
  padding-bottom: 60px;
}

/* ===== TOPBAR / HEADER ===== */
.topbar {
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-primary);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background-color: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 1.3rem;
}

.brand-icon .material-symbols-outlined {
  font-size: 22px;
  font-variation-settings: 'FILL' 1;
}

.brand-block h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand-block span.brand-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav a {
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.topnav a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* ===== NAV DROPDOWN MENU (ADMINISTRACIÓN) ===== */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
  transition: background 0.2s, color 0.2s;
}

.nav-dropdown-toggle:hover,
.nav-dropdown:hover .nav-dropdown-toggle {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  width: 210px;
  background: #FFFFFF !important;
  border: 1px solid #CBD5E1 !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2) !important;
  padding: 6px 0 !important;
  z-index: 100000 !important;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-menu.show {
  display: flex !important;
  flex-direction: column !important;
}

.topnav .nav-dropdown-menu a {
  display: flex !important;
  width: 100% !important;
  box-sizing: border-box !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  padding: 10px 16px !important;
  color: #1E293B !important;
  font-size: var(--text-sm) !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  border-radius: 0 !important;
  background: transparent !important;
  white-space: nowrap !important;
  margin: 0 !important;
}

.topnav .nav-dropdown-menu a:hover {
  background: #ECFDF5 !important;
  color: #047857 !important;
}

.topnav a.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
}

.nav-btn {
  background: var(--color-primary) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  border-radius: var(--radius-md) !important;
  padding: 7px 16px !important;
}

.nav-btn:hover {
  background: var(--color-primary-hover) !important;
  text-decoration: none !important;
}

/* ===== FOOTER ===== */
.footer-main {
  background: var(--color-sidebar);
  color: #CBD5E1;
  padding: 40px 24px 20px;
  margin-top: 60px;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid #334155;
}

.footer-brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 8px;
}

.footer-brand-sub {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-secondary);
  margin-bottom: 12px;
}

.footer-grid p {
  font-size: var(--text-sm);
  color: #94A3B8;
  line-height: 1.6;
}

.footer-col h4 {
  color: #FFFFFF;
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 8px;
  font-size: var(--text-sm);
}

.footer-col ul li a {
  color: #94A3B8;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-col ul li a:hover {
  color: #FFFFFF;
}

.footer-bottom {
  max-width: 1200px;
  margin: 20px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  color: #64748B;
}

/* ===== ALERTAS FLASH ===== */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid;
}

.alert-success {
  background: var(--color-primary-light);
  color: #064E3B;
  border-color: #6EE7B7;
}

.alert-error {
  background: var(--color-danger-light);
  color: #7F1D1D;
  border-color: #FCA5A5;
}

.alert-warning {
  background: var(--color-warning-light);
  color: #78350F;
  border-color: #FCD34D;
}

.alert-info {
  background: var(--color-info-light);
  color: #1E3A5F;
  border-color: #93C5FD;
}

/* ===== TARJETAS / PANELES ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-body {
  padding: 24px;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-header h2,
.card-header h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}

/* ===== SECCIÓN TÍTULO ===== */
.section-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

/* ===== BOTONES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-base);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s, opacity 0.2s;
  line-height: 1;
}

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

.btn-primary {
  background: var(--color-primary);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #FFFFFF;
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border-dark);
}
.btn-secondary:hover {
  background: var(--color-bg);
  color: var(--color-text);
  text-decoration: none;
}

.btn-danger {
  background: var(--color-danger);
  color: #FFFFFF;
}
.btn-danger:hover {
  background: #B91C1C;
  color: #FFFFFF;
  text-decoration: none;
}

.btn-warning {
  background: var(--color-secondary);
  color: #FFFFFF;
}
.btn-warning:hover {
  background: #B45309;
  color: #FFFFFF;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 13px 28px;
  font-size: var(--text-base);
}

/* ===== BADGE / ETIQUETA ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success    { background: var(--color-primary-light); color: #065F46; }
.badge-warning    { background: var(--color-warning-light); color: #92400E; }
.badge-danger     { background: var(--color-danger-light);  color: #991B1B; }
.badge-info       { background: var(--color-info-light);    color: #1E40AF; }
.badge-neutral    { background: #F1F5F9; color: #475569; }

/* Status-specific (recipe states) */
.status-aprobada            { background: var(--color-primary-light); color: #065F46; }
.status-pendiente_validacion { background: var(--color-warning-light); color: #92400E; }
.status-borrador            { background: #F1F5F9; color: #475569; }
.status-observada           { background: var(--color-danger-light);  color: #991B1B; }

/* ===== FORMULARIOS ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  font-family: var(--font-base);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(6, 95, 70, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-light);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Input con icono izquierdo */
.input-group {
  position: relative;
}

.input-group .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 18px;
  pointer-events: none;
}

.input-group input,
.input-group select {
  padding-left: 42px;
}

/* ===== TABLAS ===== */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

table.data-table thead tr {
  background: var(--color-primary);
  color: #FFFFFF;
}

table.data-table thead th {
  padding: 13px 16px;
  font-weight: 700;
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

table.data-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s;
}

table.data-table tbody tr:nth-child(even) {
  background: var(--color-surface-alt);
}

table.data-table tbody tr:hover {
  background: var(--color-primary-light);
}

table.data-table tbody td {
  padding: 12px 16px;
  color: var(--color-text);
  vertical-align: middle;
}

/* ===== DASHBOARD CARDS ESTADÍSTICAS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card.accent-warning { border-left-color: var(--color-secondary); }
.stat-card.accent-danger  { border-left-color: var(--color-danger); }
.stat-card.accent-info    { border-left-color: var(--color-info); }

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
}

.stat-card-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-card.accent-warning .stat-card-icon { background: var(--color-secondary-light); color: var(--color-secondary); }
.stat-card.accent-danger  .stat-card-icon { background: var(--color-danger-light);    color: var(--color-danger); }
.stat-card.accent-info    .stat-card-icon { background: var(--color-info-light);      color: var(--color-info); }

/* ===== HÉROE DASHBOARD ===== */
.dashboard-hero {
  background: var(--color-primary);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.dashboard-hero-text h2 {
  color: #FFFFFF;
  font-size: var(--text-2xl);
  font-weight: 800;
  margin-bottom: 4px;
}

.dashboard-hero-text p {
  color: #A7F3D0;
  font-size: var(--text-sm);
}

/* ===== AUTENTICACIÓN ===== */
.auth-wrapper {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: var(--color-bg);
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 460px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}

.auth-logo-icon .material-symbols-outlined {
  font-size: 28px;
  font-variation-settings: 'FILL' 1;
}

.auth-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-text);
  text-align: center;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 28px;
}

.auth-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 20px 0;
}

.auth-footer-text {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.auth-footer-text a {
  color: var(--color-primary);
  font-weight: 600;
}

/* ===== MASCOTA VIRTUAL ===== */
.pet-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.pet-avatar {
  font-size: 5rem;
  margin-bottom: 16px;
  display: block;
}

.health-bar-track {
  width: 100%;
  height: 14px;
  background: var(--color-bg);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  overflow: hidden;
  margin: 8px 0;
}

.health-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.fill-sana    { background: var(--color-primary); }
.fill-debil   { background: var(--color-secondary); }
.fill-critica { background: var(--color-danger); }
.fill-tumba   { background: #94A3B8; }

/* ===== MURO HONESTIDAD ACADÉMICA ===== */
.muro-honestidad {
  background: #FFF9F9;
  border-left: 4px solid var(--color-danger);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 20px 24px;
  margin: 24px 0;
}

.muro-honestidad h3 {
  color: var(--color-danger);
  font-size: var(--text-base);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== CHIPS / ETIQUETAS INFORMATIVAS ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.chip-primary { background: var(--color-primary-light); color: var(--color-primary); border-color: #6EE7B7; }

/* ===== GRID UTILITARIOS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }

/* Quill WYSIWYG Mobile Responsiveness */
.ql-toolbar.ql-snow {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  padding: 8px 10px !important;
  background: #F8FAFC !important;
  border-color: #CBD5E1 !important;
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}
.ql-container.ql-snow {
  border-color: #CBD5E1 !important;
  border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
  font-family: inherit !important;
  font-size: var(--text-base) !important;
}

/* ===== CONTENEDOR DE TABLAS RESPONSIVO ===== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
}
.mobile-menu-toggle:hover {
  background: rgba(0,0,0,0.05);
}

/* ===== RESPONSIVIDAD ===== */
@media (max-width: 1024px) {
  .stats-grid        { grid-template-columns: repeat(2, 1fr); }
  .footer-grid       { grid-template-columns: 1fr 1fr; }
  .grid-4            { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    position: relative;
  }
  .mobile-menu-toggle {
    display: flex;
  }
  .topnav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    background: #FFFFFF;
    border-top: 1px solid var(--color-border);
    padding: 12px 0 8px 0;
  }
  .topnav.mobile-active {
    display: flex;
  }
  .topnav a {
    padding: 12px 16px;
    font-size: var(--text-base);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .topnav a.btn {
    justify-content: center;
    margin-left: 0 !important;
    margin-top: 4px;
  }
  .stats-grid        { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3   { grid-template-columns: 1fr; }
  .grid-4, .grid-5   { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .auth-card         { padding: 28px 20px; }
  .dashboard-hero    { flex-direction: column; align-items: flex-start; }
  .footer-grid       { grid-template-columns: 1fr; gap: 24px; }

  /* Modales adaptativos en móvil */
  .modal-dialog, .card {
    max-width: 95vw !important;
  }
}

@media (max-width: 480px) {
  .page-wrapper      { padding: 0 12px 40px; }
  .stats-grid        { grid-template-columns: 1fr; }
  .grid-4, .grid-5   { grid-template-columns: 1fr; }
  .btn               { min-height: 44px; padding: 10px 16px; font-size: var(--text-sm); display: inline-flex; align-items: center; justify-content: center; }
  .card-header       { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ==========================================================================
   PÁGINA PÚBLICA — Estilos específicos de la landing page
   ========================================================================== */

/* Layout público sin restricción de ancho en hero */
.public-page { background: var(--color-bg); }
.pub-container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ----- HERO SECTION ----- */
.pub-hero {
  background: var(--color-primary);
  padding: 72px 0 56px;
  position: relative;
  overflow: hidden;
}

.pub-hero::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}

.pub-hero::after {
  content: '';
  position: absolute;
  left: -40px; bottom: -80px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}

.pub-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.pub-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 9999px;
  padding: 6px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 18px;
}

.pub-hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.2;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}

.pub-hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.82);
  line-height: 1.7;
  margin-bottom: 32px;
  font-weight: 400;
}

.pub-hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn-hero-primary {
  background: #FFFFFF;
  color: var(--color-primary);
  font-weight: 700;
  padding: 13px 28px;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}
.btn-hero-primary:hover { background: #F0FDF4; color: var(--color-primary); text-decoration: none; box-shadow: var(--shadow-md); }

.btn-hero-outline {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.5);
  color: #FFFFFF;
  font-weight: 600;
  padding: 11px 24px;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-hero-outline:hover { background: rgba(255,255,255,0.1); color: #FFFFFF; text-decoration: none; }

/* Card destacada del hero */
.pub-hero-featured {
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  position: relative;
}

.pub-hero-featured-badge {
  position: absolute;
  top: 14px; left: 14px;
  background: var(--color-secondary);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 2;
}

.pub-hero-featured-img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.pub-hero-featured-info {
  padding: 20px;
}

.pub-hero-featured-info h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 10px;
}

.pub-hero-featured-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

/* ----- SECTION HEADER ----- */
.pub-section { padding: 64px 0; }
.pub-section-alt { background: var(--color-surface); }

.pub-section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 48px;
}

.pub-section-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.pub-section-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 12px;
  line-height: 1.25;
}

.pub-section-desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.65;
}

/* ----- RECIPE CARDS (Público) ----- */
.pub-recipes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.pub-recipe-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.pub-recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.pub-recipe-img-wrap {
  position: relative;
  height: 210px;
  overflow: hidden;
  background: var(--color-bg);
}

.pub-recipe-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.pub-recipe-card:hover .pub-recipe-img-wrap img { transform: scale(1.04); }

.pub-recipe-cat-badge {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--color-primary);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.pub-recipe-rating-badge {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(0,0,0,0.65);
  color: #FCD34D;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 4px;
}

.pub-recipe-body {
  padding: 18px 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.pub-recipe-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
  line-height: 1.35;
}

.pub-recipe-native {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  color: var(--color-primary);
  font-weight: 600;
  background: var(--color-primary-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}

.pub-recipe-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 14px;
}

.pub-recipe-price {
  font-weight: 800;
  color: var(--color-secondary);
  font-size: var(--text-sm);
}

.pub-recipe-author {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.pub-recipe-card .btn { width: 100%; justify-content: center; margin-top: auto; }

/* Placeholder de imagen */
.img-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #E2E8F0 0%, #CBD5E1 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
}

.img-placeholder .material-symbols-outlined { font-size: 40px; margin-bottom: 6px; }
.img-placeholder span.label { font-size: var(--text-xs); font-weight: 600; }

/* ----- CATEGORY CARDS ----- */
.pub-categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.pub-category-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 28px 20px;
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pub-category-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  text-decoration: none;
  color: var(--color-text);
}

.pub-category-icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-lg);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pub-category-icon .material-symbols-outlined { font-size: 32px; font-variation-settings: 'FILL' 1; }

.pub-category-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.pub-category-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ----- NUTRITION SPOTLIGHT ----- */
.pub-nutrition {
  background: var(--color-primary);
  padding: 64px 0;
}

.pub-nutrition-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.pub-nutrition-title {
  font-size: 2rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 14px;
}

.pub-nutrition-desc {
  color: rgba(255,255,255,0.82);
  font-size: var(--text-base);
  line-height: 1.7;
  margin-bottom: 28px;
}

.pub-nutrition-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }

.pub-nutrition-item {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #FFFFFF;
}

.pub-nutrition-item-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pub-nutrition-item-icon .material-symbols-outlined {
  font-size: 22px;
  font-variation-settings: 'FILL' 1;
  color: #FFFFFF;
}

.pub-nutrition-item-title { font-weight: 700; font-size: var(--text-sm); }
.pub-nutrition-item-detail { font-size: var(--text-xs); color: rgba(255,255,255,0.72); margin-top: 2px; }

/* ----- STATS COUNTER BANNER ----- */
.pub-stats {
  background: var(--color-sidebar);
  padding: 48px 0;
}

.pub-stats-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  text-align: center;
}

.pub-stat-value {
  font-size: 2.8rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1;
  margin-bottom: 8px;
}

.pub-stat-label {
  font-size: var(--text-sm);
  color: #94A3B8;
  font-weight: 500;
}

/* ----- CTA FINAL ----- */
.pub-cta {
  padding: 72px 0;
  background: var(--color-bg);
}

.pub-cta-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 48px;
  background: var(--color-primary);
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.pub-cta-title {
  font-size: 2rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 12px;
}

.pub-cta-desc {
  color: rgba(255,255,255,0.82);
  font-size: var(--text-base);
  margin-bottom: 28px;
  line-height: 1.6;
}

.pub-cta-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ----- ABOUT SECTION ----- */
.pub-about {
  background: var(--color-surface);
  padding: 64px 0;
}

.pub-about-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 56px;
  align-items: center;
}

.pub-about-list { list-style: none; margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }

.pub-about-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.pub-about-list-item .material-symbols-outlined {
  color: var(--color-primary);
  font-size: 20px;
  font-variation-settings: 'FILL' 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.pub-quote-card {
  background: var(--color-primary-light);
  border: 1px solid #A7F3D0;
  border-left: 5px solid var(--color-primary);
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
}

.pub-quote-icon {
  color: var(--color-primary);
  font-size: 2.5rem;
  margin-bottom: 14px;
}

.pub-quote-text {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--color-text);
  line-height: 1.65;
  margin-bottom: 14px;
}

.pub-quote-author {
  font-weight: 700;
  color: var(--color-primary);
  font-size: var(--text-sm);
}

/* ==========================================================================
   SISTEMA DE MODALES — Universal
   ========================================================================== */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

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

.modal-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
  position: relative;
}

.modal-dialog.modal-lg { max-width: 860px; }
.modal-dialog.modal-sm { max-width: 440px; }

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
}

.modal-close {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--color-border); color: var(--color-text); }
.modal-close .material-symbols-outlined { font-size: 20px; }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ==========================================================================
   MATERIAL DESIGN — Controles de alta calidad y contraste
   ========================================================================== */

/* MD-style outlined inputs */
.md-field {
  position: relative;
  margin-bottom: 20px;
}

.md-field label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.md-field input,
.md-field select,
.md-field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  font-family: var(--font-base);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
  appearance: none;
}

.md-field input:focus,
.md-field select:focus,
.md-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(6, 95, 70, 0.18);
}

.md-field input::placeholder,
.md-field textarea::placeholder { color: var(--color-text-light); font-weight: 400; }

.md-field .md-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Select con ícono propio */
.md-select-wrap { position: relative; }
.md-select-wrap::after {
  content: 'expand_more';
  font-family: 'Material Symbols Outlined';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-text-muted);
  font-size: 20px;
}
.md-select-wrap select { padding-right: 36px; }

/* Checkbox MD */
.md-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 12px;
}
.md-checkbox input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}

/* Search bar MD */
.md-search {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid var(--color-border-dark);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.md-search:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(6,95,70,0.15);
}
.md-search-icon {
  padding: 0 14px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
}
.md-search input {
  border: none;
  padding: 11px 0;
  flex-grow: 1;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: transparent;
}
.md-search input:focus { outline: none; box-shadow: none; }

/* ==========================================================================
   CATÁLOGO PÚBLICO — Estilos específicos
   ========================================================================== */

.catalog-filters {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 28px;
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.catalog-filters .md-field { margin-bottom: 0; flex: 1; min-width: 180px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--color-text-muted);
}
.empty-state .material-symbols-outlined {
  font-size: 56px;
  color: var(--color-border-dark);
  display: block;
  margin-bottom: 14px;
}
.empty-state h3 { color: var(--color-text-muted); font-weight: 600; margin-bottom: 6px; }

/* ==========================================================================
   RESPONSIVE — Público
   ========================================================================== */

@media (max-width: 1024px) {
  .pub-hero-inner       { grid-template-columns: 1fr; gap: 32px; }
  .pub-hero-title       { font-size: 2rem; }
  .pub-nutrition-inner  { grid-template-columns: 1fr; gap: 36px; }
  .pub-about-inner      { grid-template-columns: 1fr; gap: 36px; }
  .pub-recipes-grid     { grid-template-columns: repeat(2, 1fr); }
  .pub-categories-grid  { grid-template-columns: repeat(2, 1fr); }
  .pub-stats-inner      { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}

@media (max-width: 640px) {
  .pub-hero             { padding: 48px 0 40px; }
  .pub-hero-title       { font-size: 1.6rem; }
  .pub-recipes-grid     { grid-template-columns: 1fr; }
  .pub-categories-grid  { grid-template-columns: 1fr 1fr; }
  .pub-stats-inner      { grid-template-columns: 1fr 1fr; }
  .pub-cta-inner        { padding: 36px 24px; }
  .pub-section          { padding: 44px 0; }
  .modal-dialog         { max-width: 100%; margin: 0; border-radius: var(--radius-lg); }
  .catalog-filters      { flex-direction: column; }
}

