.admin-body {
  background: #f6efe4;
}

/* Pantalla de acceso: panel de marca + formulario */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(241, 149, 157, 0.16), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(150, 178, 158, 0.18), transparent 45%),
    var(--cream);
}

.login-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(820px, 100%);
  background: var(--white);
  border-radius: 28px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}

/* Panel de marca (izquierda) */
.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 34px;
  text-align: center;
  color: var(--cream);
  background:
    radial-gradient(circle at 30% 25%, rgba(198, 126, 110, 0.35), transparent 55%),
    var(--ink);
  overflow: hidden;
}

.login-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-cloud {
  position: absolute;
  top: 22px;
  left: -14px;
  width: 96px;
  animation: login-drift 10s ease-in-out infinite;
}

.login-cloud path {
  fill: rgba(252, 248, 241, 0.10);
  stroke: rgba(252, 248, 241, 0.35);
  stroke-width: 1.6;
  stroke-dasharray: 5 5;
  stroke-linecap: round;
}

.login-star {
  position: absolute;
  width: 18px;
  animation: login-twinkle 3.6s ease-in-out infinite;
}

.login-star path {
  fill: var(--pastel-yellow);
}

.login-star-1 { top: 18%; right: 16%; }
.login-star-2 { bottom: 16%; left: 20%; width: 14px; color: var(--color-primario); animation-delay: 1.4s; }
.login-star-2 path { fill: var(--color-primario); }

@keyframes login-drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10px, -6px); }
}

@keyframes login-twinkle {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.12); }
}

.login-logo {
  position: relative;
  z-index: 1;
  width: 128px;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(252, 248, 241, 0.12);
  margin-bottom: 8px;
}

.login-brand-name {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.login-brand-slogan {
  position: relative;
  z-index: 1;
  font-size: 0.9rem;
  color: rgba(252, 248, 241, 0.72);
  max-width: 22ch;
}

.login-brand-tag {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream);
  border: 1.5px dashed rgba(252, 248, 241, 0.4);
  border-radius: 999px;
  padding: 6px 16px;
}

/* Formulario (derecha) */
.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
}

.login-form h1 {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.login-hint {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 26px;
}

.login-form .field {
  text-align: left;
  margin-bottom: 6px;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
  pointer-events: none;
}

.password-wrap .input,
.password-wrap input {
  width: 100%;
  border: 1.5px solid rgba(78, 54, 43, 0.16);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 12px 44px;
  font-size: 0.98rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.password-wrap input:focus {
  border-color: var(--terracota);
  box-shadow: 0 0 0 3px rgba(198, 126, 110, 0.16);
}

.password-toggle {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.password-toggle:hover {
  background: var(--cream);
  color: var(--ink);
}

.password-toggle.is-on {
  color: var(--terracota);
}

.password-toggle svg {
  width: 19px;
  height: 19px;
}

.login-form .btn-primary {
  margin-top: 20px;
}

.login-form .btn-primary[disabled] {
  opacity: 0.65;
  cursor: default;
}

.login-back {
  margin-top: 18px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  transition: color 0.15s ease;
}

.login-back:hover {
  color: var(--terracota);
}

@media (max-width: 680px) {
  .login-card {
    grid-template-columns: 1fr;
    width: min(400px, 100%);
  }

  .login-brand {
    padding: 32px 24px;
  }

  .login-logo {
    width: 92px;
  }

  .login-form {
    padding: 34px 28px;
  }
}

/* Estructura del panel */
.admin-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  background: var(--ink);
  color: var(--cream);
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 18px;
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(252, 248, 241, 0.15);
}

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  text-align: left;
  border: none;
  background: transparent;
  color: rgba(252, 248, 241, 0.72);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(252, 248, 241, 0.10);
  color: var(--cream);
}

.nav-item.is-active {
  background: var(--accion);
  color: var(--white);
}

.nav-link {
  display: block;
}

.nav-logout {
  color: rgba(252, 248, 241, 0.5);
}

.admin-main {
  padding: 34px clamp(18px, 4vw, 46px);
  overflow-x: hidden;
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.view-head h2 {
  font-size: 1.7rem;
}

.toolbar {
  margin-bottom: 16px;
}

.view-hint {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: -8px 0 18px;
}

.panel-title {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

/* Resumen (dashboard) */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-tile {
  background: var(--white);
  border: 1px solid rgba(78, 54, 43, 0.08);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stat-tile.is-alert .stat-value {
  color: var(--accion);
}

/* Editor de categorias */
.cat-editor {
  background: var(--cream);
  border-radius: var(--radius-md);
  padding: 14px;
}

.cat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1.5px solid rgba(78, 54, 43, 0.14);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  font-weight: 700;
  font-size: 0.88rem;
}

.cat-chip button {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(78, 54, 43, 0.1);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.cat-chip button:hover {
  background: var(--accion);
  color: var(--white);
}

.cat-add {
  display: flex;
  gap: 8px;
}

.cat-add .input {
  flex: 1;
}

/* Foto principal en el formulario de producto */
.image-item {
  position: relative;
}

.image-main-tag,
.image-main-btn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 3px 2px;
  border: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.image-main-tag {
  background: var(--ink);
  color: var(--cream);
}

.image-main-btn {
  background: rgba(78, 54, 43, 0.72);
  color: var(--cream);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.image-item:hover .image-main-btn {
  opacity: 1;
}

.image-item.is-main img {
  outline: 2px solid var(--terracota);
  outline-offset: 1px;
}

.image-remove {
  position: absolute;
  top: -6px;
  right: -6px;
}

/* Botones de reordenar */
.move-btn {
  padding: 8px 10px;
  font-size: 1rem;
  line-height: 1;
}

.stars-cell {
  color: var(--gold-texto);
  letter-spacing: 2px;
  font-size: 1rem;
}

.stock-tag {
  display: inline-block;
  font-weight: 800;
  font-size: 0.86rem;
}

.stock-tag.stock-ok { color: var(--exito); }
.stock-tag.stock-low { color: var(--gold-texto); }
.stock-tag.stock-out { color: var(--accion); }

.tipo-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
}

.tipo-reclamo {
  background: rgba(201, 76, 89, 0.12);
  color: var(--accion);
}

.tipo-queja {
  background: rgba(138, 106, 31, 0.14);
  color: var(--gold-texto);
}

/* Controles */
.input {
  width: 100%;
  border: 2px solid rgba(78, 54, 43, 0.12);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 11px 14px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.input:focus {
  border-color: var(--color-primario);
}

.input-color {
  padding: 4px;
  height: 46px;
  cursor: pointer;
}

textarea.input {
  resize: vertical;
}

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

.field > span, .field-label {
  font-weight: 800;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.field-label {
  display: block;
  margin-bottom: 8px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.92rem;
}

.field-inline input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primario);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.field-full {
  grid-column: 1 / -1;
}

.form-error {
  color: var(--accion);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 10px 0;
}

.form-msg {
  color: var(--exito);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 10px 0;
}

.panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 28px;
  max-width: 760px;
}

/* Tabla de productos */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow-x: auto;
}

/* Paginacion de la tabla */
.admin-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
}

.admin-pagination:empty {
  display: none;
}

.admin-pagination .page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 13px;
  border: 1.5px solid rgba(78, 54, 43, 0.16);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.16s ease;
}

.admin-pagination .page-btn:hover:not([disabled]):not(.is-active) {
  border-color: var(--ink);
}

.admin-pagination .page-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
  cursor: default;
}

.admin-pagination .page-btn[disabled] {
  opacity: 0.4;
  cursor: default;
}

.admin-pagination .page-nav {
  color: var(--ink-soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 16px 18px;
  border-bottom: 2px solid rgba(78, 54, 43, 0.08);
}

.table td {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(78, 54, 43, 0.06);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.row-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--cream-deep);
}

.row-name {
  font-weight: 800;
}

.row-desc {
  font-size: 0.8rem;
  color: var(--ink-soft);
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-old {
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-decoration: line-through;
}

.badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
}

.badge-on {
  background: rgba(37, 101, 79, 0.12);
  color: var(--exito);
}

.badge-off {
  background: rgba(201, 76, 89, 0.10);
  color: var(--accion);
}

.badge-star {
  background: rgba(244, 203, 122, 0.5);
  color: var(--gold-texto);
  margin-left: 6px;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  border: none;
  background: var(--cream);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--ink);
  color: var(--cream);
}

.icon-btn.danger:hover {
  background: var(--accion);
}

/* Modal de producto y galeria */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(78, 54, 43, 0.45);
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal {
  position: relative;
  background: var(--white);
  border-radius: 24px;
  box-shadow: var(--shadow-pop);
  max-height: 90vh;
  animation: modal-pop 0.26s ease both;
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.admin-modal {
  grid-template-columns: 1fr;
  width: min(680px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Boton de cerrar: circulo claro fijo arriba a la derecha */
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: var(--shadow-soft);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.modal-close:hover {
  background: var(--accion);
  color: var(--white);
  transform: rotate(90deg);
}

.gallery-body {
  overflow-y: auto;
  padding: 32px 30px;
}

/* El formulario separa cuerpo (con scroll) y pie de acciones (fijo) */
.product-form {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
}

.product-form-body {
  overflow-y: auto;
  padding: 32px 30px 22px;
}

/* Pie de acciones siempre visible, sin solaparse con el contenido */
.product-form .modal-actions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 30px;
  background: var(--white);
  border-top: 1px solid rgba(78, 54, 43, 0.12);
}

.product-form .modal-actions .btn {
  flex: 1;
  min-width: 140px;
}

.product-form h3, .gallery-body h3 {
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.image-list:empty {
  margin-bottom: 0;
}

.image-item {
  position: relative;
}

.image-item img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.image-item button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-size: 0.8rem;
  line-height: 1;
}

.image-picker .picker-preview {
  width: 200px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  background: var(--cream);
}

.image-picker .picker-logo {
  object-fit: contain;
  padding: 8px;
}

.hero-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  max-height: 52vh;
  overflow-y: auto;
  margin-top: 16px;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.gallery-grid img:hover {
  border-color: var(--color-primario);
  transform: scale(1.03);
}

/* Notificacion */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--cream);
  font-weight: 700;
  padding: 13px 26px;
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  z-index: 90;
  animation: rise 0.25s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Responsive */
@media (max-width: 760px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .sidebar-brand {
    padding: 0 12px;
    width: 100%;
  }

  .sidebar-nav {
    flex-direction: row;
    flex: 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
