/* ===== Panel de administración ===== */
body.admin { background: #f4f4f5; }
body.busy { cursor: progress; }
body.busy button[type="submit"] { opacity: .6; pointer-events: none; }

label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: #333; }
label small, legend small { font-weight: 400; color: var(--muted); }
.admin input:not([type=checkbox]):not([type=file]), .admin select, .admin textarea {
  width: 100%; border: 1.5px solid #e2e2e4; border-radius: 10px; padding: 10px 12px; font-size: 15px;
  background: #fff; outline: 0; font-weight: 400; color: var(--ink);
}
.admin input:focus, .admin select:focus, .admin textarea:focus { border-color: var(--red); }
.hint { color: var(--muted); font-size: 13.5px; margin: 6px 0 14px; }
.form-error { background: var(--red-soft); color: var(--red-dark); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 0; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: #ececee; }
label.btn { display: inline-flex; cursor: pointer; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 80% 10%, rgba(227,27,35,.3), transparent 45%), #111; }
.login-card { background: #fff; width: 100%; max-width: 380px; border-radius: 18px; padding: 28px 24px; display: grid; gap: 14px; }
.login-card img { width: 230px; margin: 0 auto 4px; }
.login-card h1 { margin: 0; font-size: 19px; text-align: center; }
.demo-note { margin: 0; background: #FFF7D6; color: #7a5b00; font-size: 13px; padding: 9px 12px; border-radius: 10px; text-align: center; }
.login-card .back { text-align: center; color: var(--muted); font-size: 13.5px; text-decoration: none; }

/* header */
.a-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.a-header-row { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 6px; }
.a-logo { height: 30px; width: auto; }
.mode { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 9px; border-radius: 999px; background: #E3F7EC; color: #11753d; }
.mode.demo { background: #FFF7D6; color: #7a5b00; }
.a-actions { margin-left: auto; display: flex; gap: 6px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 12px 16px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--red); border-bottom-color: var(--red); }
@media (max-width: 560px) {
  .a-logo { height: 24px; }
  .a-actions .btn-outline { display: none; }
  .tab { flex: 1; padding: 12px 8px; }
}

.a-main { padding-top: 22px; padding-bottom: 60px; max-width: 980px; }
.a-empty { background: #fff; border: 1px dashed #d6d6d8; border-radius: var(--radius); padding: 36px 16px; text-align: center; color: var(--muted); list-style: none; }

/* toolbar */
.toolbar { display: grid; grid-template-columns: 1fr 220px auto; gap: 10px; margin-bottom: 16px; }
@media (max-width: 760px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar #newProduct { grid-column: 1 / -1; grid-row: 1; }
}

/* lista productos / categorías */
.p-list, .c-list { display: grid; gap: 10px; margin: 0; padding: 0; }
.p-row, .c-row {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 12px;
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; list-style: none;
}
.p-row.off { opacity: .6; }
.p-row > img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #f4f4f4; }
.p-name { margin: 0; font-weight: 600; line-height: 1.3; }
.p-meta { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.p-meta s { font-size: 12.5px; }
.p-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.p-tags .tag { font-size: 10px; padding: 3px 7px; box-shadow: none; }
.tag-hidden { background: #9a9aa0; }
.p-btns { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid #e2e2e4; background: #fff; font-size: 15px; display: grid; place-items: center; }
.icon-btn:hover:not(:disabled) { border-color: var(--black); }
.icon-btn.danger:hover { border-color: var(--red); background: var(--red-soft); }
.icon-btn:disabled { opacity: .35; cursor: default; }
@media (max-width: 600px) {
  .p-row { grid-template-columns: 56px 1fr; }
  .p-row > img { width: 56px; height: 56px; }
  .p-row .p-btns { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }
}

.c-row { grid-template-columns: auto 1fr auto; }
.c-order { display: flex; flex-direction: column; gap: 4px; }
.c-order .icon-btn { width: 32px; height: 26px; font-size: 11px; }
.cat-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
@media (max-width: 600px) {
  .cat-form { grid-template-columns: 1fr; }
  .c-row .btn-outline { padding: 0 10px; font-size: 13px; }
}

/* ajustes */
.settings { display: grid; gap: 14px; }
.card-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; }
.card-box h3 { margin: 0; font-size: 16px; }
.card-box .hint { margin: 0; }
.backup { margin-top: 22px; }
.settings > .btn { justify-self: start; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } .settings > .btn { justify-self: stretch; } }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* modal de producto */
.a-modal { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 24px; max-width: 640px; }
.a-modal h2 { margin: 0; font-size: 21px; padding-right: 40px; }
.check-inline { display: flex; align-items: center; gap: 8px; font-weight: 500; height: 44px; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--red); }
fieldset { border: 1.5px solid #ececee; border-radius: 12px; padding: 12px 14px 14px; margin: 0; }
legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.mt { margin-top: 12px; }
.tag-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-check { display: flex; align-items: center; gap: 6px; border: 1.5px solid #ececee; border-radius: 10px; padding: 7px 10px; cursor: pointer; }
.tag-check input { width: 16px; height: 16px; accent-color: var(--red); }
.tag-check .tag { box-shadow: none; }
.tag-check:has(input:checked) { border-color: var(--black); background: #fafafa; }

.img-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.img-grid .hint { grid-column: 1 / -1; margin: 0; }
.img-item { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: #f4f4f4; border: 1px solid var(--line); }
.img-item img { width: 100%; height: 100%; object-fit: cover; }
.img-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; font-size: 17px; line-height: 1; }
.main-pill, .img-main { position: absolute; left: 4px; bottom: 4px; right: 4px; font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 3px 4px; text-align: center; border: 0; }
.main-pill { background: var(--red); color: #fff; }
.img-main { background: rgba(255,255,255,.92); color: var(--ink); }
@media (max-width: 480px) { .img-grid { grid-template-columns: repeat(2, 1fr); } }

.form-actions { display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: -24px; background: #fff; padding: 12px 0 4px; margin-bottom: -4px; }
@media (max-width: 760px) {
  .a-modal { padding: 20px 16px; border-radius: 18px 18px 0 0; }
  .form-actions { bottom: -20px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .form-actions .btn { flex: 1; }
}
.icon-btn svg { width: 18px; height: 18px; fill: var(--ink); }
.icon-btn.danger svg { fill: var(--red); }
