/* =====================================================================
   ActivaPro Panel — tokens + componentes
   Dirección de arte: "blanco corporativo, oficina de licencias".
   Superficies blancas, tinta azul marino, acento naranja de activación
   (heredado de la marca), teal para "entregado". Firma: los códigos y
   claves se muestran como tickets mono con borde perforado.
   ===================================================================== */

:root {
  color-scheme: light;
  /* Superficies */
  --surface-base: #ffffff;
  --surface-sunken: #f3f5f8;
  --surface-raised: #ffffff;
  --surface-overlay: #ffffff;
  --surface-nav: #ffffff;
  --surface-nav-active: #fff1e8;
  --hairline: rgba(16, 32, 58, 0.08);
  --hairline-strong: rgba(16, 32, 58, 0.14);
  /* Texto */
  --ink-1: #10203a;
  --ink-2: #4f5d73;
  --ink-3: #8390a3;
  --ink-inverse: #ffffff;
  --ink-nav: #4f5d73;
  /* Acento (naranja de activación) */
  --accent: #e8590c;
  --accent-pressed: #c94a06;
  --accent-subtle: rgba(232, 89, 12, 0.12);
  --accent-ink: #ffffff;
  /* Semánticos */
  --success: #0f8a6a;
  --success-subtle: rgba(15, 138, 106, 0.12);
  --warning: #b7791f;
  --warning-subtle: rgba(183, 121, 31, 0.14);
  --danger: #c62828;
  --danger-subtle: rgba(198, 40, 40, 0.10);
  --info: #1e5eff;
  --info-subtle: rgba(30, 94, 255, 0.10);
  --muted-subtle: rgba(15, 42, 74, 0.08);
  /* Sombras (light: elevación por sombra, dos capas) */
  --shadow-e1: 0 1px 2px rgba(16, 32, 58, 0.04), 0 6px 20px -12px rgba(16, 32, 58, 0.12);
  --shadow-e2: 0 2px 4px rgba(16, 32, 58, 0.08), 0 20px 40px -16px rgba(16, 32, 58, 0.28);
  --shadow-e3: 0 4px 8px rgba(16, 32, 58, 0.10), 0 32px 64px -20px rgba(16, 32, 58, 0.40);
  /* Tipografía */
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Escala espacial 4pt */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;
  /* Radios con jerarquía */
  --r-chip: 999px; --r-control: 10px; --r-card: 16px; --r-sheet: 24px;
  /* Movimiento */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --dur-fast: 120ms; --dur-base: 200ms; --dur-slow: 320ms;
  /* Layout */
  --gutter: 16px;
  --nav-w: 248px;
  --topbar-h: 56px;
  --tabbar-h: 60px;
}

/* ---------- Reset y base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--surface-sunken);
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  font-feature-settings: "tnum" 1, "cv11" 1, "ss01" 1;
  letter-spacing: -0.004em;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
::selection { background: var(--accent-subtle); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-control); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -0.02em; text-wrap: balance; color: var(--ink-1); }
h1 { font-size: 24px; line-height: 30px; font-weight: 700; }
h2 { font-size: 20px; line-height: 26px; font-weight: 700; }
h3 { font-size: 15px; line-height: 22px; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; text-wrap: pretty; }
.mono, code, .ticket { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); }
.small { font-size: 13px; line-height: 18px; }
.caption { font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-2 { margin-top: var(--s-2); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); }

/* ---------- Shell: topbar móvil + tabbar; sidebar en desktop ---------- */
.shell { display: grid; grid-template-rows: var(--topbar-h) 1fr; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--gutter);
  background: rgba(255,255,255,.88); color: var(--ink-1);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  padding-top: env(safe-area-inset-top);
}
.brand { display: flex; align-items: center; gap: var(--s-3); color: var(--ink-1); font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(145deg, #ff7a2e, var(--accent) 60%, #c94a06); display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-size: 15px; font-weight: 800; box-shadow: 0 4px 10px -4px rgba(232, 89, 12, .6), inset 0 1px 0 rgba(255,255,255,.25); flex: 0 0 auto; }
.brand__sub { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-family: var(--font-body); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.iconbtn {
  position: relative; width: 40px; height: 40px; border-radius: var(--r-control);
  display: grid; place-items: center; background: transparent; border: 0; color: var(--ink-2); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), color var(--dur-fast);
}
.iconbtn:hover { background: var(--surface-sunken); color: var(--ink-1); }
.iconbtn:active { transform: scale(.96); }
.iconbtn .dot { position: absolute; top: 8px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

.sidenav { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface-raised); border-top: 1px solid var(--hairline);
  box-shadow: 0 -8px 24px -16px rgba(16,32,58,.3);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; min-height: 48px;
  transition: color var(--dur-fast) var(--ease-out);
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.is-active { color: var(--accent); }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a .dot { position: absolute; margin-left: 22px; margin-top: -2px; width: 8px; height: 8px; border-radius: 999px; background: var(--accent); }

.main { padding: var(--s-4) var(--gutter) calc(var(--tabbar-h) + var(--s-8) + env(safe-area-inset-bottom)); max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.page-head .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

@media (min-width: 1024px) {
  .shell { grid-template-columns: var(--nav-w) 1fr; grid-template-rows: 1fr; }
  .topbar { display: none; }
  .tabbar { display: none; }
  .sidenav {
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100dvh; padding: var(--s-5) var(--s-3);
    background: var(--surface-nav); color: var(--ink-nav); border-right: 1px solid var(--hairline);
  }
  .sidenav .brand { padding: var(--s-2) var(--s-3) var(--s-6); }
  .sidenav a.nav { display: flex; align-items: center; gap: var(--s-3); padding: 9px var(--s-3); border-radius: var(--r-control); color: var(--ink-2); font-weight: 500; font-size: 14px; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
  .sidenav a.nav:hover { background: var(--surface-sunken); color: var(--ink-1); text-decoration: none; }
  .sidenav a.nav.is-active { background: var(--surface-nav-active); color: var(--accent-pressed); font-weight: 600; }
  .sidenav a.nav.is-active svg { color: var(--accent); }
  .sidenav a.nav svg { width: 19px; height: 19px; color: var(--ink-3); transition: color var(--dur-fast); }
  .sidenav a.nav:hover svg { color: var(--ink-1); }
  .sidenav .nav__count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 7px; }
  .sidenav__foot { margin-top: auto; padding: var(--s-3); border-top: 1px solid var(--hairline); display: flex; align-items: center; gap: var(--s-3); }
  .main { padding: var(--s-8) var(--s-8) var(--s-12); }
  h1 { font-size: 28px; line-height: 34px; }
}

/* ---------- Tarjetas ---------- */
.card { background: var(--surface-raised); border-radius: var(--r-card); box-shadow: var(--shadow-e1); border: 1px solid var(--hairline); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-4) var(--s-2); }
.card__head + .card__body { padding-top: var(--s-2); }
.card__body { padding: var(--s-4); }
.card--flat { box-shadow: none; }
.grid { display: grid; gap: var(--s-4); }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--kpi { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: repeat(3, 1fr); } .grid--kpi { grid-template-columns: repeat(4, 1fr); } }
.span-2 { grid-column: 1 / -1; }
@media (min-width: 720px) { .span-2 { grid-column: span 2; } }

/* KPI */
.kpi { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-1); min-height: 92px; }
.kpi__value { font-family: var(--font-display); font-size: 26px; line-height: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi__label { font-size: 12px; color: var(--ink-2); }
.kpi__delta { font-size: 12px; color: var(--ink-3); }
.kpi--accent { border-color: transparent; background: linear-gradient(128deg, #ff7a2e 0%, var(--accent) 55%, #d24f08 100%); color: #fff; box-shadow: 0 12px 28px -14px rgba(232, 89, 12, .55); position: relative; overflow: hidden; }
.kpi--accent::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 999px; background: rgba(255,255,255,.12); pointer-events: none; }
.kpi--accent .kpi__label, .kpi--accent .kpi__delta { color: rgba(255,255,255,.88); }
.kpi--action { cursor: pointer; transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.kpi--action:hover { transform: translateY(-2px); box-shadow: var(--shadow-e2); text-decoration: none; }

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-chip); font-size: 12px; font-weight: 600; line-height: 16px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill--success { background: var(--success-subtle); color: var(--success); }
.pill--accent { background: var(--accent-subtle); color: var(--accent); }
.pill--warning { background: var(--warning-subtle); color: var(--warning); }
.pill--info { background: var(--info-subtle); color: var(--info); }
.pill--danger { background: var(--danger-subtle); color: var(--danger); }
.pill--muted { background: var(--muted-subtle); color: var(--ink-3); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-sunken); color: var(--ink-2); font-size: 12px; font-weight: 500; border: 1px solid var(--hairline); }

/* Firma: ticket perforado para códigos y claves */
.ticket {
  display: inline-block; position: relative; padding: 2px 10px 2px 14px; border-radius: 6px;
  background: var(--surface-sunken); border: 1px solid var(--hairline-strong); font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--ink-1);
}
.ticket::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 0; border-left: 2px dotted var(--hairline-strong); }
.ticket--block { display: block; padding: var(--s-3) var(--s-4) var(--s-3) var(--s-5); white-space: pre-wrap; word-break: break-word; font-weight: 500; line-height: 1.55; border-radius: var(--r-control); }
.ticket--block::before { left: 9px; top: 10px; bottom: 10px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-4); border-radius: var(--r-control); border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; user-select: none;
  background: var(--surface-raised); color: var(--ink-1); border-color: var(--hairline-strong);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), opacity var(--dur-fast);
}
.btn:hover { background: var(--surface-sunken); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn--primary { background: linear-gradient(180deg, #f0651a, var(--accent)); color: var(--accent-ink); border-color: transparent; box-shadow: 0 1px 2px rgba(232,89,12,.3), 0 6px 14px -8px rgba(232,89,12,.7), inset 0 1px 0 rgba(255,255,255,.18); }
.btn--primary:hover { background: var(--accent-pressed); box-shadow: 0 1px 2px rgba(232,89,12,.3), 0 8px 18px -8px rgba(232,89,12,.8); }
.btn--success { background: var(--success); color: #fff; border-color: transparent; }
.btn--success:hover { filter: brightness(.94); }
.btn--danger { background: var(--danger-subtle); color: var(--danger); border-color: transparent; }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--muted-subtle); color: var(--ink-1); }
.btn--sm { min-height: 36px; padding: 0 var(--s-3); font-size: 13px; }
.btn--block { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 999px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn--ghost.is-loading::after, .btn.is-loading:not(.btn--primary):not(.btn--success)::after { border-color: var(--hairline-strong); border-top-color: var(--ink-1); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-control);
  border: 1px solid var(--hairline-strong); background: var(--surface-raised); color: var(--ink-1);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.textarea.mono { font-family: var(--font-mono); font-size: 13px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b8799' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } }
.form-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; padding-top: var(--s-2); }
.input-group { display: flex; gap: var(--s-2); }
.input-group .input { flex: 1; }

/* Filtros */
.filters { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.filters .input, .filters .select { min-height: 40px; width: auto; flex: 1 1 140px; }
.chips { display: flex; gap: var(--s-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--r-chip); border: 1px solid var(--hairline-strong); background: var(--surface-raised); color: var(--ink-2); font-size: 13px; font-weight: 600; transition: background var(--dur-fast), color var(--dur-fast); }
.chip:hover { text-decoration: none; background: var(--surface-sunken); }
.chip.is-active { background: var(--ink-1); color: var(--ink-inverse); border-color: var(--ink-1); }
.chip .n { font-size: 11px; opacity: .75; }

/* ---------- Tablas (desktop) y listas (móvil) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 10px var(--s-3); border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.table td { padding: 12px var(--s-3); border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-link { cursor: pointer; transition: background var(--dur-fast); }
.table tr.is-link:hover { background: var(--surface-sunken); }
.table .right { text-align: right; }

.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--hairline); color: inherit; min-height: 64px; transition: background var(--dur-fast); }
.list__item:last-child { border-bottom: 0; }
.list__item:hover { background: var(--surface-sunken); text-decoration: none; }
.list__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__meta { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--ink-inverse); background: linear-gradient(160deg, #24395c, var(--ink-1)); flex: 0 0 auto; letter-spacing: .02em; }
.avatar--sm { width: 32px; height: 32px; border-radius: 9px; font-size: 11px; }
.avatar--success { background: var(--success); } .avatar--accent { background: var(--accent); } .avatar--warning { background: var(--warning); } .avatar--info { background: var(--info); } .avatar--muted { background: var(--ink-3); }

/* Responsive: tabla en desktop, lista en móvil */
.only-desk { display: none; }
.only-mob { display: block; }
@media (min-width: 720px) { .only-desk { display: block; } .only-mob { display: none; } }

/* ---------- Estados ---------- */
.empty { padding: var(--s-10) var(--s-4); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s-3); color: var(--ink-2); }
.empty__icon { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-sunken); display: grid; place-items: center; color: var(--ink-3); }
.empty h3 { color: var(--ink-1); }
.flash { display: block; padding: var(--s-3) var(--s-4); border-radius: var(--r-control); margin-bottom: var(--s-4); font-size: 14px; line-height: 1.5; font-weight: 500; border: 1px solid transparent; animation: flash-in var(--dur-slow) var(--ease-out) both; text-wrap: pretty; }
.flash strong { font-weight: 700; }
.flash a { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.flash--success { background: var(--success-subtle); color: var(--success); }
.flash--danger { background: var(--danger-subtle); color: var(--danger); }
.flash--warning { background: var(--warning-subtle); color: var(--warning); }
.flash--info { background: var(--info-subtle); color: var(--info); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.skeleton { background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--hairline) 50%, var(--surface-sunken) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 6px; min-height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Timeline (historial del pedido) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; padding: 0 0 var(--s-4) var(--s-6); }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 8px; height: 8px; border-radius: 999px; background: var(--ink-3); }
.timeline li::after { content: ""; position: absolute; left: 9.5px; top: 18px; bottom: -2px; width: 1px; background: var(--hairline-strong); }
.timeline li:last-child::after { display: none; }
.timeline li.is-success::before { background: var(--success); box-shadow: 0 0 0 4px var(--success-subtle); }
.timeline li.is-accent::before { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-subtle); }
.timeline li.is-danger::before { background: var(--danger); }
.timeline .t { font-weight: 600; }
.timeline .m { font-size: 12px; color: var(--ink-3); }

/* ---------- Chat (conversación con el cliente) ---------- */
.chat { display: flex; flex-direction: column; gap: var(--s-2); max-height: 480px; overflow-y: auto; padding: var(--s-2); background: var(--surface-sunken); border-radius: var(--r-control); }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble--in { align-self: flex-start; background: var(--surface-raised); border: 1px solid var(--hairline); border-bottom-left-radius: 4px; }
.bubble--out { align-self: flex-end; background: var(--ink-1); color: var(--ink-inverse); border-bottom-right-radius: 4px; }
.bubble .m { display: block; font-size: 10px; opacity: .6; margin-top: 4px; }

/* ---------- Gráfica de barras (CSS puro) ---------- */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 120px; padding-top: var(--s-2); }
.bars .bar { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars .bar i { display: block; border-radius: 4px 4px 2px 2px; background: var(--accent); min-height: 2px; transform-origin: bottom; animation: grow var(--dur-slow) var(--ease-out) both; }
.bars .bar.is-zero i { background: var(--hairline-strong); }
.bars .bar b { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 600; color: var(--ink-3); opacity: 0; transition: opacity var(--dur-fast); }
.bars .bar:hover b { opacity: 1; }
.bars-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; font-size: 10px; color: var(--ink-3); text-align: center; margin-top: 6px; }
@keyframes grow { from { transform: scaleY(0); } }

/* Barra de stock: dientes de llave */
.stockbar { display: flex; gap: 2px; height: 8px; }
.stockbar i { flex: 1; border-radius: 2px; background: var(--hairline-strong); }
.stockbar i.on { background: var(--success); }
.stockbar.is-low i.on { background: var(--warning); }
.stockbar.is-empty i { background: var(--danger-subtle); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--hairline); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--s-4); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; padding: 10px 14px; color: var(--ink-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--dur-fast), border-color var(--dur-fast); }
.tabs a:hover { text-decoration: none; color: var(--ink-1); }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tabpanel { display: none; }
.tabpanel.is-active { display: block; animation: flash-in var(--dur-base) var(--ease-out) both; }

/* ---------- Dropdown / campana ---------- */
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); width: min(360px, calc(100vw - 32px)); background: var(--surface-overlay); border-radius: var(--r-card); box-shadow: var(--shadow-e2); border: 1px solid var(--hairline); z-index: 40; opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); transform-origin: top right; color: var(--ink-1); }
.dropdown.is-open .menu { opacity: 1; transform: none; pointer-events: auto; }
.menu__head { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--hairline); display: flex; justify-content: space-between; align-items: center; }
.menu__list { max-height: 360px; overflow-y: auto; }
.notif { display: block; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--hairline); color: inherit; }
.notif:hover { background: var(--surface-sunken); text-decoration: none; }
.notif.is-unread { box-shadow: inset 3px 0 0 var(--accent); }
.notif .t { font-weight: 600; font-size: 14px; }
.notif .b { font-size: 12px; color: var(--ink-2); white-space: pre-line; }
.notif .m { font-size: 11px; color: var(--ink-3); }

/* Paginación */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding-top: var(--s-4); font-size: 13px; color: var(--ink-2); }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--gutter); background: #fff; position: relative; overflow: hidden; }
.login::before { content: ""; position: absolute; inset: 0; background:
  radial-gradient(52% 44% at 18% 12%, rgba(232, 89, 12, .10), transparent 70%),
  radial-gradient(40% 36% at 88% 88%, rgba(16, 32, 58, .07), transparent 70%),
  linear-gradient(180deg, #fff 0%, #f7f8fb 100%); pointer-events: none; }
.login::after { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none; background-image: linear-gradient(var(--hairline) 1px, transparent 1px), linear-gradient(90deg, var(--hairline) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(60% 60% at 50% 40%, #000 20%, transparent 100%); -webkit-mask-image: radial-gradient(60% 60% at 50% 40%, #000 20%, transparent 100%); }
.login__card { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: var(--s-10) var(--s-8) var(--s-8); background: var(--surface-raised); border-radius: var(--r-sheet); box-shadow: 0 2px 4px rgba(16,32,58,.04), 0 30px 60px -24px rgba(16,32,58,.25); border: 1px solid var(--hairline); animation: login-in 480ms var(--ease-out) both; }
.login__card .brand { margin-bottom: var(--s-8); }
.login__card .brand__mark { width: 44px; height: 44px; border-radius: 13px; font-size: 20px; }
.login__card h1 { font-size: 26px; line-height: 32px; margin-bottom: var(--s-1); }
.login__card .muted { margin-bottom: var(--s-2); }
.login__card .field + .field { margin-top: var(--s-1); }
.login__card .btn--primary { margin-top: var(--s-3); min-height: 48px; font-size: 15px; }
.login__foot { margin-top: var(--s-6); text-align: center; font-size: 12px; color: var(--ink-3); }
@keyframes login-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .login__card { padding: var(--s-8) var(--s-5) var(--s-6); border-radius: var(--r-card); } }

/* Copiar */
.copy { cursor: pointer; }
.copy.is-copied { color: var(--success); }

/* Detalle: dos columnas en desktop */
.detail { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 1024px) { .detail { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); align-items: start; } }

/* Reducir movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media print { .topbar, .tabbar, .sidenav, .btn, .filters { display: none !important; } .main { padding: 0; } }
