/* admin.css — panel del catálogo */
:root {
  --brand: #2B59FF; --on-brand: #fff;
  --paper: #F3F4F7; --surface: #FFFFFF; --ink: #15171C; --muted: #646A76; --line: #E2E4EA;
  --soft: color-mix(in srgb, var(--brand) 10%, var(--surface));
  --bad: #C2352B; --ok: #138A55; --wa: #1FA855;
  --font-d: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-b: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light; box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #0E1014; --surface: #181B21; --ink: #F0F1F4; --muted: #9BA1AC; --line: #2A2E37; --soft: color-mix(in srgb, var(--brand) 18%, var(--surface)); color-scheme: dark; }
}
*, *::before, *::after { box-sizing: inherit; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15.5px/1.5 var(--font-b); padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
h1, h2 { font-family: var(--font-d); letter-spacing: -0.015em; line-height: 1.15; }
h1 { font-size: 28px; margin: 8px 0 14px; }
h1 small { font: 500 15px var(--font-b); color: var(--muted); margin-left: 6px; }
h2 { font-size: 19px; margin: 0 0 4px; }
a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
small { color: var(--muted); font-weight: 400; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; max-width: 980px; margin: 0 auto; }
.brand { font: 800 20px var(--font-d); text-decoration: none; }
.see { font-size: 14px; font-weight: 600; color: var(--muted); }
.tabs {
  position: sticky; top: 0; z-index: 10; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); max-width: 100%;
  background: color-mix(in srgb, var(--paper) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
@media (min-width: 1010px) { .tabs { padding-left: calc(50% - 476px); padding-right: calc(50% - 476px); } }
.tabs a { flex: 0 0 auto; padding: 8px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 14.5px; color: var(--muted); }
.tabs a.on { background: var(--ink); color: var(--paper); }
.tabs .out { margin-left: auto; }
.badge { font-style: normal; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--on-brand); font-size: 12px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 8px 18px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin: 14px 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
input, select, textarea {
  font: 400 16px/1.4 var(--font-b); color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; min-height: 44px; width: 100%;
}
input[type=color] { padding: 4px; height: 44px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); margin: 0; }
input[type=file] { background: none; border: 1px dashed var(--line); font-size: 14px; }
textarea { resize: vertical; }
.grid2, .grid3 { display: grid; gap: 14px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 15px var(--font-b); text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-wa { background: var(--wa); color: #fff; border-color: transparent; margin-top: 10px; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 4px 0; font: 600 14px var(--font-b); color: var(--brand); cursor: pointer; }
.link.danger, .mini.danger { color: var(--bad); }
.mini { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.back { display: inline-block; margin-top: 6px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.back::before { content: "‹ "; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 40px 10px; }
.flash { background: var(--soft); border-radius: 12px; padding: 11px 14px; margin: 10px 0; font-weight: 500; }
.alert { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--bad); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger-zone { margin: 8px 0 30px; }

/* Switches */
.switches { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.switch { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 25px; border-radius: 13px; background: var(--line); position: relative; transition: background .2s; flex: 0 0 auto; border: 0; padding: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(17px); }
.switch.sm span { font-size: 13px; color: var(--muted); }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr 1fr; } .kpis .kpi:first-child { grid-column: 1 / -1; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; }
.kpi small { font-size: 13px; }
.kpi b { font: 800 26px/1.2 var(--font-d); font-variant-numeric: tabular-nums; }
.kpi:first-child b { color: var(--brand); }
@media (prefers-color-scheme: dark) { .kpi:first-child b { color: color-mix(in srgb, var(--brand) 60%, white); } }
.kpi span { font-size: 13px; color: var(--muted); }
.bars { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.2fr) 2fr auto; gap: 10px; align-items: center; font-size: 14px; }
.bars span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars i { height: 10px; border-radius: 5px; background: var(--paper); position: relative; overflow: hidden; }
.bars i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--brand); border-radius: 5px; }
.bars b { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }

/* Filtros */
.filters { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 16px 0 10px; }
@media (max-width: 520px) { .filters { grid-template-columns: 1fr; } }

/* Pedidos */
.orders { display: grid; gap: 10px; }
@media (min-width: 820px) { .orders { grid-template-columns: 1fr 1fr; align-items: start; } }
.order { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.order.st-nuevo { border-left-color: var(--brand); }
.order.st-confirmado { border-left-color: #D99A1E; }
.order.st-listo { border-left-color: #7C5CE0; }
.order.st-entregado { border-left-color: var(--ok); }
.order.st-cancelado { opacity: .6; }
.order header { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.order header div { display: flex; flex-direction: column; }
.order header b { font: 700 18px var(--font-d); }
.order header span { font-size: 13px; color: var(--muted); }
.order select { width: auto; min-height: 38px; padding: 6px 10px; font-size: 14px; }
.who { margin: 8px 0 0; font-weight: 600; }
.meta { margin: 2px 0 0; color: var(--muted); font-size: 14px; display: flex; gap: 6px; }
.meta b { margin-left: auto; color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--brand); }
details p { font-size: 14px; margin: 8px 0 0; }
.lines { list-style: none; margin: 8px 0 0; padding: 10px 12px; background: var(--paper); border-radius: 12px; font-size: 14px; }
.lines li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; }
.lines span { display: flex; flex-direction: column; }
.lines b { font-variant-numeric: tabular-nums; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 20px 0; }
.pager a { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; background: var(--surface); }
.pager a.on { background: var(--ink); color: var(--paper); }

/* Productos */
.plist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.plist li:last-child { border-bottom: 0; }
.plist li.is-hidden .pl-main { opacity: .55; }
.pl-main { flex: 1; display: flex; gap: 12px; align-items: center; text-decoration: none; min-width: 0; }
.thumb { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--soft); display: grid; place-items: center; font: 800 20px var(--font-d); color: var(--brand); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.pl-txt { display: flex; flex-direction: column; min-width: 0; }
.pl-txt b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-txt small { font-size: 13px; }

.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photo { width: 116px; display: flex; flex-direction: column; gap: 4px; }
.photo img { width: 116px; height: 116px; object-fit: cover; border-radius: 12px; }
.photo.add { height: 116px; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; text-align: center; cursor: pointer; position: relative; color: var(--muted); }
.photo.add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo.add span { display: flex; flex-direction: column; font-size: 13px; }
.photo.add small { font-size: 12px; }
.previews { display: flex; flex-wrap: wrap; gap: 8px; }
.previews:empty { display: none; }
.previews img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.previews .alert { width: 100%; margin: 0; }

.builder { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.builder legend { font: 700 16px var(--font-d); padding: 0 6px; }
.ogroup { background: var(--paper); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.og-head, .og-cfg, .oitem { display: flex; gap: 8px; align-items: center; }
.og-head input { font-weight: 600; }
.og-head .link { flex: 0 0 auto; }
.og-cfg select { width: auto; flex: 1; }
.og-cfg .mini { flex: 0 0 auto; }
.oitem .oi-p { width: 110px; flex: 0 0 110px; }
.x-btn { flex: 0 0 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 20px; color: var(--muted); cursor: pointer; }

/* Categorías */
.inline-add { display: flex; gap: 10px; margin: 14px 0; }
.clist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.clist li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.c-edit { display: flex; gap: 8px; flex: 1 1 320px; }
.c-edit .num { width: 70px; flex: 0 0 70px; }
.c-side { display: flex; gap: 14px; align-items: center; }

/* Ajustes */
.share-card { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.share-card > div:first-child { flex: 1 1 300px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.copy-row { display: flex; gap: 8px; width: 100%; }
#qr { padding: 12px; background: #fff; border-radius: 14px; }
#qr img, #qr canvas { width: 160px; height: 160px; }
.upload { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; }
.up-logo { width: 84px; height: 84px; object-fit: cover; border-radius: 20px; }
.up-cover { width: 100%; max-width: 320px; aspect-ratio: 16/6; object-fit: cover; border-radius: 12px; }
.htable { border-collapse: collapse; width: 100%; }
.htable th { text-align: left; font-weight: 600; font-size: 14px; padding-right: 8px; }
.htable td { padding: 4px; }
.htable input[type=time] { min-width: 0; }
@media (max-width: 480px) { .htable th { font-size: 13px; } .htable td { padding: 3px 2px; } }

/* Acceso */
body.auth { display: grid; place-items: center; min-height: 100dvh; padding: 20px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px; }
.auth-card h1 { margin-top: 0; }
.auth-card .stack { margin-top: 16px; }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }