/* ============================================================
   Jimena Style — Admin · sistema de diseño premium (sin frameworks)
   Coherente con la tienda: porcelana cálida + rosewood + oro
   champagne, tipografía editorial (Fraunces + Figtree, self-hosteadas
   en /fonts), sombras suaves en capas, reveal on-scroll y skeletons.
   Respeta prefers-reduced-motion.
   ============================================================ */

/* ---------- Tipografías (variables, subset latino) ---------- */

@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-var.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-italic-var.woff2') format('woff2');
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('../fonts/figtree-var.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('../fonts/figtree-italic-var.woff2') format('woff2');
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Parisienne';
  src: url('../fonts/parisienne.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Sidebar oscura elegante */
  --sidebar: #1E1418;
  --sidebar-2: #2A1B21;
  --sidebar-ink: #C4AFB6;
  --sidebar-ink-strong: #F7EFF1;

  /* Paleta clara — porcelana + rosewood + oro */
  --bg: #FBF7F4;
  --bg-soft: #F6EDE8;
  --surface: #FFFFFF;
  --ink: #26191F;
  --ink-soft: #4A3A41;
  --muted: #8E7B82;
  --primary: #B4637A;
  --primary-dark: #93465C;
  --primary-deep: #6E3145;
  --primary-soft: #F6DFE5;
  --rose-mist: #FBEFF2;
  --gold: #B8933E;
  --gold-soft: #E8D9AE;
  --accent: var(--gold);
  --line: #EFE3DD;
  --line-soft: #F5EBE5;

  /* Semánticos */
  --ok: #3E8E5A;
  --ok-soft: #E2F2E8;
  --err: #C0392B;
  --err-soft: #FBE7E4;
  --warn: #B7791F;
  --warn-soft: #FBF0DC;
  --info: #2B6CB0;
  --info-soft: #E1EDFA;

  /* Gradientes */
  --grad-rose: linear-gradient(135deg, #C97B92 0%, #A85D74 45%, #93465C 100%);
  --grad-gold: linear-gradient(120deg, #D8B45A 0%, #B08A2E 100%);

  /* Geometría, sombras y movimiento */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 1px 4px rgba(38, 25, 31, .05), 0 6px 22px rgba(38, 25, 31, .06);
  --shadow-lift: 0 6px 18px rgba(38, 25, 31, .09), 0 22px 48px rgba(38, 25, 31, .12);
  --shadow-glow: 0 6px 20px rgba(180, 99, 122, .35);
  --trans: 200ms cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  /* Tipografía */
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Figtree', system-ui, 'Segoe UI', Roboto, sans-serif;
  --script: 'Parisienne', 'Segoe Script', cursive;
  --font: var(--sans); /* alias legado */

  --sidebar-w: 248px;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Drawer mobile abierto: el lock solo aplica en mobile, así no queda la
   página sin scroll si el viewport pasa a desktop con el drawer abierto. */
@media (max-width: 960px) { body.nav-lock { overflow: hidden; } }

a { color: var(--primary-dark); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--primary); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  margin: 0 0 .5rem;
  line-height: 1.18;
  letter-spacing: .005em;
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
h1 em, h2 em { color: var(--primary-dark); font-style: italic; }

::selection { background: var(--primary-soft); color: var(--primary-deep); }

/* Scrollbar fino en todo el admin */
* { scrollbar-width: thin; scrollbar-color: #DCC6CD transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #DCC6CD; border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* Focus rings accesibles (solo teclado) */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(180, 99, 122, .4);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- animaciones y reveal on-scroll ---------- */

@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes subir { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes acercar { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes brillo { to { background-position: -200% 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }

/* .reveal: invisible hasta entrar al viewport (site.js agrega .in-view). */
/* Entrada por animation (no transition): al terminar deja de aplicar y no
   pisa las transiciones de hover propias de cards/paneles. */
.reveal { opacity: 0; transform: translateY(22px); }
.reveal.in-view {
  opacity: 1; transform: none;
  animation: subir 650ms var(--ease-out) var(--d, 0ms) backwards;
}
/* Escalonado automático dentro de grillas */
.grid > .reveal:nth-child(2) { --d: 70ms; }
.grid > .reveal:nth-child(3) { --d: 140ms; }
.grid > .reveal:nth-child(4) { --d: 210ms; }
.grid > .reveal:nth-child(5) { --d: 280ms; }
.grid > .reveal:nth-child(6) { --d: 350ms; }
/* Delays manuales: <div class="reveal d2"> */
.d1 { --d: 90ms; } .d2 { --d: 180ms; } .d3 { --d: 270ms; } .d4 { --d: 360ms; } .d5 { --d: 450ms; }

/* ---------- shell: sidebar + main ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-2) 0%, var(--sidebar) 42%, #170F12 100%);
  color: var(--sidebar-ink);
  display: flex; flex-direction: column;
  z-index: 50;
  transition: transform 260ms var(--ease-out);
}
.sidebar .brand {
  padding: 1.25rem 1.35rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.sidebar .brand .logo {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 600; color: #fff; display: block;
  letter-spacing: .01em;
}
.sidebar .brand .logo em {
  color: #D8B45A; font-style: normal;
  font-family: var(--script);
  font-size: 1.16em; line-height: 1; margin-left: .06em; vertical-align: -.08em;
}
.sidebar .brand small {
  display: block; margin-top: .2rem;
  text-transform: uppercase; letter-spacing: .3em; font-size: .6rem;
  color: var(--sidebar-ink);
}
.sidebar nav {
  flex: 1; overflow-y: auto; padding: .85rem .65rem;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); }
.sidebar .nav-sec {
  margin: 1rem .7rem .35rem;
  font-size: .6rem; text-transform: uppercase; letter-spacing: .22em;
  color: #7E6069;
}
.sidebar nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .52rem .75rem; margin: .12rem 0;
  border-radius: 10px; color: var(--sidebar-ink);
  font-size: .88rem; font-weight: 400; letter-spacing: .015em;
  transition: background var(--trans), color var(--trans), box-shadow var(--trans);
}
.sidebar nav a .ico { width: 1.15rem; flex: none; opacity: .75; text-align: center; transition: opacity var(--trans); }
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: var(--sidebar-ink-strong); }
.sidebar nav a:hover .ico { opacity: 1; }
.sidebar nav a.active {
  background: var(--grad-rose); color: #fff; font-weight: 500;
  box-shadow: var(--shadow-glow);
}
.sidebar nav a.active .ico { opacity: 1; }
.sidebar .side-foot {
  padding: .95rem 1.15rem; border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: .78rem;
}
.sidebar .side-foot .who { color: var(--sidebar-ink-strong); word-break: break-all; }
.sidebar .side-foot button {
  margin-top: .55rem; width: 100%;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14);
  color: var(--sidebar-ink-strong); border-radius: 9px; padding: .42rem .6rem;
  font: inherit; font-size: .8rem; cursor: pointer;
  transition: background var(--trans), border-color var(--trans);
}
.sidebar .side-foot button:hover { background: rgba(201, 123, 146, .22); border-color: rgba(201, 123, 146, .45); }

/* Overlay del drawer mobile (lo maneja site.js con .show) */
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(30, 20, 24, .5);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity 250ms ease;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

.main {
  flex: 1; margin-left: var(--sidebar-w);
  padding: 1.6rem 2rem 3.5rem;
  min-width: 0;
  animation: page-in 480ms var(--ease-out) both;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap;
}
.topbar h1 { margin: 0; }
.topbar .crumbs {
  color: var(--muted); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .22em; margin-top: .1rem;
}
.topbar .crumbs::before { content: '— '; color: var(--gold); letter-spacing: 0; }

.menu-toggle {
  display: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: .4rem .65rem; cursor: pointer;
  font-size: 1.05rem; color: var(--ink); line-height: 1;
  box-shadow: var(--shadow);
  transition: background var(--trans), box-shadow var(--trans);
}
.menu-toggle:hover { background: var(--rose-mist); }

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 48px rgba(0, 0, 0, .45); }
  .main { margin-left: 0; padding: 1rem 1rem 2.5rem; }
  .menu-toggle { display: inline-flex; align-items: center; }
}
@media (min-width: 961px) { .sidebar-overlay { display: none; } }
@media (max-width: 420px) {
  .topbar { gap: .6rem; margin-bottom: 1rem; }
  h1 { font-size: 1.35rem; }
}

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.35rem;
  margin-bottom: 1.2rem;
}
.card > h2 { margin-bottom: .9rem; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; margin-bottom: .95rem; flex-wrap: wrap;
}
/* D12: un título con un texto largo sin espacios (el email en la ficha de cliente) se corta en vez de desbordar. */
.card-head h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
}

.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.05rem 1.2rem; position: relative; overflow: hidden;
  transition: box-shadow var(--trans), transform var(--trans);
}
.stat-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.stat-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--grad-rose);
}
.stat-card.acc::before { background: var(--grad-gold); }
.stat-card.warn::before { background: var(--warn); }
.stat-card.ok::before { background: var(--ok); }
.stat-card .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.stat-card .val {
  font-family: var(--serif); font-size: 2.1rem; font-weight: 700;
  margin-top: .1rem; line-height: 1.1; color: var(--ink);
  font-variant-numeric: lining-nums;
}
.stat-card .sub { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.stat-card .mini-list { margin-top: .4rem; font-size: .86rem; }
.stat-card .mini-list div { display: flex; justify-content: space-between; padding: .12rem 0; }
.stat-card .mini-list b { font-variant-numeric: tabular-nums; }

/* ---------- tablas ---------- */

.tbl-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
}
table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .87rem; }
table.tbl th {
  position: sticky; top: 0; z-index: 2;
  background: #FBF6F2; color: var(--muted);
  text-align: left; font-size: .67rem; text-transform: uppercase; letter-spacing: .12em;
  font-weight: 600;
  padding: .62rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: .58rem .8rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background 140ms ease; }
table.tbl tbody tr:hover { background: var(--rose-mist); }
table.tbl tr.clickable { cursor: pointer; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl .muted { color: var(--muted); }
table.tbl .acciones { text-align: right; white-space: nowrap; }

.thumb {
  width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover;
  border: 1px solid var(--line); background: var(--bg-soft); display: block;
}
.thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 1rem; }

.empty {
  padding: 2.4rem 1rem; text-align: center; color: var(--muted); font-size: .9rem;
  animation: aparecer 450ms ease both;
}

/* ---------- chips / badges ---------- */

.chip {
  display: inline-block; padding: .16rem .62rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .03em; white-space: nowrap;
}
.chip.est-PendingPayment { background: var(--warn-soft); color: var(--warn); }
.chip.est-Paid { background: var(--ok-soft); color: var(--ok); }
.chip.est-Fulfilling { background: var(--primary-soft); color: var(--primary-deep); }
.chip.est-Shipped { background: var(--info-soft); color: var(--info); }
.chip.est-Delivered { background: #DDF1E8; color: #17765C; }
.chip.est-Cancelled { background: #EFE7E3; color: #7E6F76; }
.chip.est-Refunded { background: var(--err-soft); color: var(--err); }
.chip.on { background: var(--ok-soft); color: var(--ok); }
.chip.off { background: #EFE7E3; color: #7E6F76; }
.chip.tipo-f { background: var(--info-soft); color: var(--info); }
.chip.tipo-d { background: var(--primary-soft); color: var(--primary-deep); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.err { background: var(--err-soft); color: var(--err); }
.chip.rol { background: var(--primary-soft); color: var(--primary-deep); margin-right: .25rem; }

/* ---------- botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--grad-rose); color: #fff;
  border: 1px solid transparent;
  border-radius: 10px; padding: .5rem 1.05rem;
  font: inherit; font-size: .86rem; font-weight: 500; letter-spacing: .02em;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 2px 8px rgba(147, 70, 92, .22);
  transition: box-shadow var(--trans), transform var(--trans), background var(--trans), filter var(--trans);
}
.btn:hover { color: #fff; box-shadow: var(--shadow-glow); transform: translateY(-1px); filter: brightness(1.04); }
.btn:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(147, 70, 92, .25); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.ghost {
  background: transparent; color: var(--primary-dark);
  border-color: #E9CBD4; box-shadow: none;
}
.btn.ghost:hover { background: var(--rose-mist); box-shadow: none; filter: none; }
.btn.danger { background: transparent; color: var(--err); border-color: transparent; box-shadow: none; }
.btn.danger:hover { background: var(--err-soft); box-shadow: none; filter: none; }
.btn.sm { padding: .3rem .68rem; font-size: .78rem; border-radius: 8px; }
.btn.neutral { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn.neutral:hover { background: var(--bg); box-shadow: none; filter: none; }

/* ---------- formularios ---------- */

label.field { display: block; margin-bottom: .9rem; }
label.field > span, .field-lbl {
  display: block; font-size: .7rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: .3rem;
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="date"], input[type="search"], input[type="file"],
select, textarea {
  width: 100%; padding: .52rem .7rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: .88rem;
  transition: border-color var(--trans), box-shadow var(--trans);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(180, 99, 122, .18);
}
input::placeholder, textarea::placeholder { color: #BBA9AF; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
textarea { resize: vertical; min-height: 90px; }

/* ---------- dropdowns premium (reemplazo del popup nativo del select) ---------- */

.dd-oculto {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  opacity: 0 !important; pointer-events: none !important;
  margin: -1px !important; padding: 0 !important; border: 0 !important;
}
.dd-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; padding: .52rem .7rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: .88rem; text-align: left; cursor: pointer;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.dd-trigger:hover { border-color: #DFCBC2; }
.dd-trigger:focus-visible, .dd-trigger.dd-abierto {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(180, 99, 122, .18);
}
.dd-trigger .dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-trigger .dd-chev {
  display: inline-flex; flex: none; color: var(--primary-dark);
  transition: transform 240ms var(--ease-out);
}
.dd-trigger .dd-chev svg { width: 14px; height: 14px; }
.dd-trigger.dd-abierto .dd-chev { transform: rotate(180deg); }
/* Variantes que en el admin eran select.…: replicadas para el trigger */
.dd-trigger.adm-sel-inline { width: auto; min-width: 100px; }
.dd-trigger.adm-sel-inline.ancho { min-width: 140px; }
table.tbl .dd-trigger { padding: .3rem .5rem; font-size: .84rem; min-width: 70px; }

.dd-panel {
  position: fixed; z-index: 400;
  background: rgba(255, 255, 255, .95);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lift);
  padding: .35rem; max-height: 300px; overflow-y: auto;
  animation: acercar 170ms var(--ease-out);
  transform-origin: top center;
}
.dd-panel.dd-arriba { transform-origin: bottom center; }
.dd-item {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .45rem .65rem; border-radius: 8px;
  font-size: .86rem; font-weight: 500; color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}
.dd-item.dd-activo { background: var(--rose-mist); color: var(--primary-dark); }
.dd-item[aria-selected="true"] { color: var(--primary-dark); font-weight: 600; }
.dd-item .dd-check {
  display: inline-flex; opacity: 0; color: var(--primary); transform: scale(.6);
  transition: opacity 150ms ease, transform 150ms var(--ease-out);
}
.dd-item .dd-check svg { width: 13px; height: 13px; }
.dd-item[aria-selected="true"] .dd-check { opacity: 1; transform: none; }
.dd-item.dd-deshabilitado { opacity: .45; cursor: not-allowed; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.check {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .88rem; cursor: pointer; margin: .3rem 1.1rem .3rem 0;
}
.check input { width: auto; }

.filters { display: flex; gap: .7rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.filters label.field { margin-bottom: 0; min-width: 160px; flex: 0 1 auto; }
.filters .grow { flex: 1 1 220px; }

.form-actions { display: flex; gap: .7rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }

.hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }

/* tabla editable inline (variantes / overrides) */
table.tbl input, table.tbl select { padding: .3rem .5rem; font-size: .84rem; min-width: 70px; }
table.tbl td.tight { padding: .3rem .45rem; }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--line); margin-bottom: 1.1rem; flex-wrap: wrap; }
.tabs button {
  background: none; border: none; font: inherit; cursor: pointer;
  padding: .55rem .95rem; font-size: .88rem; font-weight: 500; letter-spacing: .02em;
  color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color var(--trans), border-color var(--trans);
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: aparecer 300ms ease both; }

/* ---------- paginación ---------- */

.pager { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; margin-top: .9rem; flex-wrap: wrap; }
.pager button {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; min-width: 32px; padding: .3rem .55rem;
  font: inherit; font-size: .8rem; cursor: pointer;
  transition: background var(--trans), border-color var(--trans);
}
.pager button:hover:not(:disabled) { background: var(--rose-mist); border-color: #E9CBD4; }
.pager button.cur { background: var(--grad-rose); border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(147, 70, 92, .25); }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .info { font-size: .78rem; color: var(--muted); margin-right: .5rem; }

/* ---------- modal ---------- */

.modal-back {
  position: fixed; inset: 0; background: rgba(30, 20, 24, .55);
  display: none; align-items: flex-start; justify-content: center;
  padding: 4vh 1rem; z-index: 100; overflow-y: auto;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.modal-back.open { display: flex; animation: aparecer 200ms ease both; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(30, 20, 24, .4);
  width: 100%; max-width: 620px; padding: 1.4rem 1.5rem;
  animation: modalIn 240ms var(--ease-out) both;
}
.modal.wide { max-width: 820px; }
.modal .modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal .modal-head h2 { margin: 0; }
.modal .x {
  background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--muted);
  line-height: 1; padding: .2rem .45rem; border-radius: 7px;
  transition: background var(--trans), color var(--trans);
}
.modal .x:hover { background: var(--rose-mist); color: var(--primary-dark); }

/* ---------- toasts (deslizan desde la derecha; site.js agrega .show) ---------- */

#toasts {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 200;
  display: flex; flex-direction: column; gap: .55rem; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: .6rem;
  background: rgba(38, 25, 31, .94); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 12px; padding: .72rem 1rem;
  font-size: .87rem; box-shadow: var(--shadow-lift);
  border-left: 4px solid var(--ok);
  transform: translateX(calc(100% + 2rem));
  transition: transform 380ms var(--ease-out), opacity 300ms ease;
  cursor: pointer;
}
.toast.show { transform: none; }
.toast.err { border-left-color: #E06C57; }
.toast.warn { border-left-color: #D9A03F; }
.toast .t-ico { flex: none; margin-top: .05rem; }

/* ---------- loading / spinner / skeletons shimmer ---------- */

.loading {
  color: var(--muted); font-size: .88rem; padding: 1.5rem; text-align: center;
  animation: aparecer 400ms ease both;
}

.spinner {
  width: 34px; height: 34px; margin: 1.8rem auto;
  border: 3px solid var(--line); border-top-color: var(--primary);
  border-radius: 50%; animation: girar .8s linear infinite;
}

.skeleton, .sk-linea {
  background: linear-gradient(90deg, #F2E6E0 25%, #FBF3EF 50%, #F2E6E0 75%);
  background-size: 200% 100%;
  animation: brillo 1.4s infinite;
  border-radius: 8px;
}
.sk-linea { height: 13px; }
.sk-linea.media { width: 70%; }
.sk-linea.corta { width: 45%; }
/* Filas de carga para tablas: Jimena.skeletonRows(colspan, filas) */
tr.sk-row td { padding: .85rem .8rem; }

/* ---------- barras CSS (reportes) ---------- */

.bars { display: flex; flex-direction: column; gap: .45rem; }
/* Columna de valor en auto: los montos largos ("$ 47.250.000,00") no entran
   en un ancho fijo y desbordarían la card; con auto el track de la barra cede. */
.bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: .7rem; align-items: center; font-size: .84rem; }
.bar-row .bar-lbl { color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bar-track { background: var(--bg-soft); border-radius: 6px; height: 22px; overflow: hidden; }
.bar-row .bar-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #C97B92, #93465C);
  min-width: 2px; transition: width .5s var(--ease-out);
}
.bar-row.acc .bar-fill { background: var(--grad-gold); }
.bar-row .bar-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 90px minmax(0, 1fr) auto; } }

/* ---------- login ---------- */

body.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 15% -5%, rgba(180, 99, 122, .3) 0%, transparent 60%),
    radial-gradient(700px 420px at 92% 10%, rgba(184, 147, 62, .18) 0%, transparent 55%),
    linear-gradient(165deg, #2A1B21 0%, var(--sidebar) 55%, #140D10 100%);
  padding: 1rem;
}
.auth-card {
  position: relative; overflow: hidden;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  width: 100%; max-width: 400px; padding: 2.4rem 2.2rem;
  animation: acercar 500ms var(--ease-out) both;
}
.auth-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--gold) 100%);
}
.auth-card .logo {
  font-family: var(--serif); font-size: 2rem; font-weight: 600;
  text-align: center; display: block; color: var(--ink);
}
.auth-card .logo em {
  color: var(--primary-dark); font-style: normal;
  font-family: var(--script);
  font-size: 1.16em; line-height: 1; margin-left: .06em; vertical-align: -.08em;
}
.auth-card .sub {
  text-align: center; color: var(--muted); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .34em; margin: .25rem 0 1.7rem;
}
.auth-card .btn { width: 100%; justify-content: center; padding: .62rem; margin-top: .4rem; }
.auth-err {
  display: none; background: var(--err-soft); color: var(--err);
  border-radius: var(--radius-sm); padding: .55rem .8rem; font-size: .84rem; margin-bottom: .9rem;
}
.auth-err.show { display: block; animation: subir 300ms var(--ease-out) both; }

/* ---------- misc ---------- */

.row { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.mt { margin-top: 1rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .3rem 1rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.img-grid { display: flex; gap: .8rem; flex-wrap: wrap; }
.img-card {
  width: 130px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow);
  transition: box-shadow var(--trans), transform var(--trans);
}
.img-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.img-card img { width: 100%; height: 100px; object-fit: cover; display: block; }
.img-card .meta { padding: .35rem .5rem; font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: .3rem; }
.img-card .meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.totales { max-width: 320px; margin-left: auto; font-size: .9rem; }
.totales div { display: flex; justify-content: space-between; padding: .22rem 0; }
.totales .total { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .5rem; font-weight: 700; font-size: 1.05rem; }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .toast { transform: none; }
}


/* ===== Extra paginas admin ===== */
/* ===== Pulido de páginas del backoffice (adm-*) — se mergea DESPUÉS de site.css ===== */

/* Grilla principal 2fr/1fr (dashboard, editor de producto, detalle de orden).
   Se usa junto con .grid (que aporta display:grid + gap) y colapsa a una columna
   en pantallas medianas para que todo quede cómodo en mobile (360px). */
.adm-grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .adm-grid-main { grid-template-columns: minmax(0, 1fr); } }

/* Utilidad: anula el margen inferior (cards dentro de grillas, .filters dentro de .card-head) */
.adm-mb0 { margin-bottom: 0 !important; }

/* Skeletons complementarios — siempre combinados con .sk-linea de la base (shimmer) */
.adm-sk-val { display: inline-block; width: 2.2em; max-width: 100%; height: 1.05em; border-radius: 10px; vertical-align: -.12em; }
.adm-sk-txt { display: inline-block; width: 9em; max-width: 70%; height: .8em; border-radius: 6px; vertical-align: middle; }
.adm-sk-chip { display: inline-block; width: 92px; height: 26px; border-radius: 999px; vertical-align: middle; }
.adm-sk-bars { display: flex; flex-direction: column; gap: .7rem; padding: .3rem 0 .15rem; }
.adm-sk-bars .sk-linea { height: 22px; border-radius: 6px; }

/* Nota al pie de la tarjeta de login */
.adm-auth-note { text-align: center; margin: 1.2rem 0 0; }


/* ===== Extra paginas admin ===== */
/* ===== Extras de páginas del backoffice (namespace .adm-) ===== */

/* Layout dividido 3/2 (Monedas, Pagos) — colapsa a 1 columna en pantallas chicas */
.adm-split { display: grid; gap: 1.1rem; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.adm-split > .card { margin-bottom: 0; }
.adm-split > div > .card:last-child { margin-bottom: 0; }
@media (max-width: 1000px) { .adm-split { grid-template-columns: minmax(0, 1fr); } }

/* Hint pegado debajo del card-head */
p.adm-hint-head { margin: -.45rem 0 1rem; }

/* Card interna plana (proveedores de pago) */
.card.adm-card-plana { box-shadow: none; margin-bottom: .9rem; }
.card.adm-card-plana:last-child { margin-bottom: 0; }

/* Ícono decorativo de estados vacíos */
.adm-empty-ico { display: block; font-size: 1.5rem; line-height: 1; color: var(--primary); opacity: .45; margin-bottom: .45rem; }

/* Pila de skeletons para paneles que no son tabla */
.adm-sk-stack { display: flex; flex-direction: column; gap: .7rem; padding: .45rem 0 .65rem; }

/* Input de stock inline en la tabla de inventario */
table.tbl input.adm-inp-stock { width: 85px; display: inline-block; }

/* Selects compactos en línea (mapa moneda ↔ proveedor) */
select.adm-sel-inline { width: auto; min-width: 100px; }
select.adm-sel-inline.ancho { min-width: 140px; }

/* Card angosta (umbral de envío gratis) */
.card.adm-narrow { max-width: 480px; }
/* Configuración del negocio (zona horaria + vencimiento de los checkouts, D07) */
.card.adm-negocio { max-width: 640px; }

/* Check alineado con la base de los filtros (Inventario) */
.filters .adm-check-filtro { margin-bottom: .4rem; }

/* Página de error y 404 propia del backoffice (D11) */
.card.adm-error { max-width: 640px; }
.adm-error-cod {
  display: block; font-family: var(--serif); font-size: 2.8rem; font-weight: 700; line-height: 1;
  color: var(--primary); margin-bottom: .5rem; font-variant-numeric: lining-nums;
}
.card.adm-error > h2 { margin-bottom: .6rem; }
.adm-error-ruta { overflow-wrap: anywhere; }
.adm-error-ctas { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
