/* ==========================================================================
   Panel de administrador (public/admin/)
   ========================================================================== */
.admin-body { min-height: 100vh; background: #f3f1ec; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- Inicio de sesión (dos columnas) ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #fff; }
.login__aside { display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; color: #fff;
  background: var(--brand-900); border-right: 3px solid var(--gold); }
.login__aside .brandline { display: flex; align-items: center; gap: 12px; font-size: 18px; letter-spacing: .06em; }
.login__aside .brandline b { font-weight: 800; }
.login__aside .brandline img { height: 44px; width: auto; }
.login__aside h2 { max-width: 14em; font-size: 32px; line-height: 1.12; }
.login__aside p { max-width: 30em; margin-top: 12px; color: #b6c3d1; font-size: 15.5px; }
.login__main { display: grid; place-items: center; padding: 32px 24px; }
.login__card { width: 100%; max-width: 380px; }
.login__logo-sm { display: none; height: 52px; width: auto; margin: 0 auto 20px; }
.login__card h1 { font-size: 26px; }
.login__card .sub { margin: 6px 0 24px; color: var(--muted); }
.login__links { display: flex; justify-content: space-between; margin-top: 18px; }

/* ---------- Estructura del panel ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; background: var(--brand-900); color: #fff; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.side__brand img { height: 38px; width: auto; }
.side__brand b { display: block; font-size: 15px; line-height: 1.1; }
.side__brand span { font-size: 12px; color: #8fa1b4; }
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__nav button { display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 0 12px; border-radius: var(--r-md); color: #b6c3d1; font-weight: 500; font-size: 14.5px; text-align: left; }
.side__nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.side__nav button.is-on { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.side__nav .ico { font-size: 18px; }
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); }
.side__foot a, .side__foot button { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 12px; border-radius: var(--r-md); color: #b6c3d1; font-size: 14px; text-decoration: none; text-align: left; }
.side__foot a:hover, .side__foot button:hover { background: rgba(255,255,255,.07); color: #fff; }
.side__user { padding: 10px 12px 4px; font-size: 12.5px; color: #8fa1b4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { padding: 32px 36px 56px; max-width: 1180px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; }
.stat { padding: 18px 20px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat .lbl { display: block; font-size: 13px; color: var(--muted); }
.stat b { display: block; margin-top: 4px; font-size: 26px; letter-spacing: -.02em; line-height: 1.1; }

.panel { margin-bottom: 20px; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; }
.panel h2 { margin-bottom: 16px; font-size: 17px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tools .input { width: auto; flex: 1; min-width: 180px; }
.tools select.input { flex: 0 1 240px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #fafafb; }
tbody tr:last-child td { border-bottom: 0; }
.code-chip { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.code { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); background: var(--soft); color: var(--brand); font-size: 12.5px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.ph { width: 46px; height: 46px; border-radius: var(--r-sm); background: var(--soft) center/cover no-repeat; }
.stk { display: inline-flex; align-items: center; border: 1px solid #c5c7cf; border-radius: var(--r-md); }
.stk button { width: 28px; height: 30px; display: grid; place-items: center; }
.stk button:hover { background: var(--soft); }
.stk b { min-width: 30px; text-align: center; font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status--ok { color: var(--ok); } .status--low { color: var(--warn); } .status--out { color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form .full { grid-column: 1 / -1; }
.drop { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px; border: 1px dashed #b4b7c0; border-radius: var(--r-md); background: var(--soft); color: var(--muted); font-size: 14px; }
.drop:hover { border-color: var(--ink); color: var(--ink); }
.drop .ico { font-size: 24px; }
.prev { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.prev__cell { width: 112px; }
.prev__cell .prev__item { width: 112px; height: 112px; }
.prev__item { position: relative; width: 96px; height: 96px; border-radius: var(--r-md); background: var(--soft) center/cover no-repeat; border: 1px solid var(--line); }
.prev__item b { position: absolute; left: 4px; bottom: 4px; padding: 1px 7px; border-radius: var(--r-sm); background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; }
.prev__item button { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; }
/* Selector del tipo de descripción */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.mode { position: relative; display: block; cursor: pointer; }
.mode input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mode__body { display: block; height: 100%; padding: 14px 16px 14px 46px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff; transition: border-color .2s, box-shadow .2s, background-color .2s; }
.mode__body::before { content: ""; position: absolute; left: 16px; top: 17px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #b4b7c0; background: #fff; transition: border-color .2s, box-shadow .2s; }
.mode__body b { display: block; font-size: 14.5px; color: var(--ink); }
.mode__body small { display: block; margin-top: 3px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.mode:hover .mode__body { border-color: #c9c3b3; }
.mode input:checked + .mode__body { border-color: var(--brand); background: #f4f8fc; box-shadow: 0 0 0 3px rgba(13,58,97,.1); }
.mode input:checked + .mode__body::before { border-color: var(--brand); box-shadow: inset 0 0 0 4px #fff; background: var(--brand); }
.mode input:focus-visible + .mode__body { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Fotos con descripción y stock propios */
.prev--photo { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.prev__cell--photo { width: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fcfbf8; }
.prev__cell--photo .prev__item { width: 100%; height: auto; aspect-ratio: 4 / 3; }
.prev__code { align-self: flex-start; padding: 2px 9px; border-radius: var(--r-sm); background: var(--soft); color: var(--brand); font-size: 12.5px; font-weight: 700; letter-spacing: .03em; }
.prev__desc { width: 100%; min-height: 78px; padding: 8px 10px; border: 1px solid #c5c7cf; border-radius: var(--r-sm); background: #fff; font-size: 13.5px; line-height: 1.45; resize: vertical; }
.prev__desc:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,58,97,.15); }
.stepper { display: flex; align-items: stretch; align-self: flex-start; border: 1px solid #c5c7cf; border-radius: var(--r-md); background: #fff; overflow: hidden; }
.stepper button { width: 38px; height: 36px; display: grid; place-items: center; font-size: 16px; color: var(--ink-2); transition: background-color .15s; }
.stepper button:hover { background: var(--soft); color: var(--brand); }
.stepper button:active { background: #ece7da; }
.stepper__in { width: 64px; height: 36px; padding: 0 4px; border: 0; border-left: 1px solid #e0e2e8; border-right: 1px solid #e0e2e8; background: #fff; text-align: center; font-weight: 700; font-size: 15px; -moz-appearance: textfield; appearance: textfield; }
.stepper__in::-webkit-outer-spin-button, .stepper__in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper__in:focus { outline: 0; background: #f4f8fc; }
.total { display: flex; align-items: baseline; gap: 10px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--soft); }
.total b { font-size: 24px; color: var(--brand); line-height: 1; }
.total span { font-size: 13px; color: var(--muted); }
.sub { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.3; }
.stk--total { padding: 0 14px; min-height: 30px; background: var(--soft); border-color: var(--line); }
.stk--total b { min-width: 0; }

.note { display: flex; gap: 12px; margin-bottom: 16px; padding: 14px 16px; border-radius: var(--r-md); background: var(--soft); color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.note .ico { font-size: 20px; margin-top: 1px; color: var(--gold-700); }
.empty-admin { text-align: center; padding: 48px 12px; color: var(--muted); }
.empty-admin b { display: block; font-size: 17px; color: var(--ink); margin-bottom: 4px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; }
  .side__brand { padding: 0; }
  .side__nav { flex-direction: row; flex-wrap: wrap; }
  .side__foot { margin: 0 0 0 auto; flex-direction: row; padding: 0; border: 0; }
  .side__user { display: none; }
  .content { padding: 22px 16px 48px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .login { grid-template-columns: 1fr; }
  .login__aside { display: none; }
  .login__logo-sm { display: block; }
  .login__main { text-align: center; }
  .login__card .field, .login__card form { text-align: left; }
}
@media (max-width: 600px) {
  .form { grid-template-columns: 1fr; }
  .modes { grid-template-columns: 1fr; }
  .prev--photo { grid-template-columns: 1fr; }
  .side__nav button span:last-child, .side__foot span:last-child { display: none; }
  .side__nav button, .side__foot a, .side__foot button { padding: 0 11px; }
  .panel { padding: 16px; }
  thead { display: none; }
  tr { display: grid; grid-template-columns: 56px 1fr auto; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  td { border: 0; padding: 2px 0; }
  td:nth-child(1) { grid-row: 1 / span 3; }
  td:nth-child(2) { grid-column: 2 / span 2; }
  td:nth-child(6) { grid-column: 2 / span 2; }
  .row-actions { justify-content: flex-start; }
}

/* Etiqueta de sección en la tabla de productos */
.chip-section { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #fbf3dc; color: #7a5b0a; font-weight: 700; font-size: 11px; }
