@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,700&family=Inter:wght@400;500;600;700&display=swap");

/* Los nombres de aqui se quedan: ~85 reglas de este archivo ya los usan. Lo
   que cambia es de donde sacan el color: ahora leen `core/tokens.css`, el
   mismo del que lee `pos.css`. Antes el panel iba en un morado y la caja en
   otro distinto, y el tono brincaba al cruzar de pantalla.
   `--green` y `--red` NO siguen a la marca: significan bien y mal, y tienen
   que leerse igual aunque la marca cambie. */
:root {
  --brand: var(--ls-primary);
  --brand-dark: var(--ls-primary-deep);
  --heading: var(--ls-primary-deep);
  --section: var(--ls-primary-strong);
  --brand-lilac: var(--ls-lilac);
  --brand-coral: var(--ls-coral);
  --brand-soft: var(--ls-primary-soft);
  --ink: var(--ls-ink);
  --text: var(--ls-ink);
  --muted: var(--ls-muted);
  --line: var(--ls-line);
  --canvas: var(--ls-canvas);
  --surface: var(--ls-surface);
  --green: var(--ls-ok);
  --red: var(--ls-danger);
  --mint: var(--ls-ok);
  --teal: var(--ls-primary-strong);
  --shadow: var(--ls-shadow);
  --font: var(--ls-font);
  --font-display: var(--ls-font-display);
  --radius: var(--ls-radius);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}
h1, .page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 32px);
  color: var(--heading);
  line-height: 1.2;
  margin: 0;
}
h2, .card h2 {
  font-size: 18px;
  color: var(--section);
  margin: 0 0 12px;
}
a { color: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--brand-dark);
  color: #fff;
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  padding: 4px 8px 12px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), var(--brand-coral));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.brand strong,
.brand small { display: block; }
.brand strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand small {
  font-size: 11px;
  color: var(--brand-lilac);
  margin-top: 4px;
  font-weight: 500;
}
.brand-logo {
  height: 46px;
  width: auto;
  max-width: 168px;
  object-fit: contain;
  flex-shrink: 0;
}
.login-page .brand-logo { height: 52px; }

.nav { margin-top: 18px; }
.nav p {
  margin: 18px 10px 7px;
  color: var(--brand-lilac);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav a,
.nav-disabled {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  margin: 2px 0;
}
.nav-icon { display: inline-flex; width: 20px; height: 20px; flex-shrink: 0; }
.nav-icon svg { width: 100%; height: 100%; fill: currentColor; }
.nav a { color: rgba(255, 255, 255, 0.88); }
.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.nav a.active {
  box-shadow: inset 3px 0 0 var(--brand-coral);
}
.nav-disabled { color: rgba(255, 255, 255, 0.38); }

.sidebar-user {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 16px 6px 4px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 9px;
  align-items: center;
}
.sidebar-user strong,
.sidebar-user small { display: block; font-size: 12px; }
.sidebar-user small { color: var(--brand-lilac); }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
}
.sidebar .avatar {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.link-button,
button.link-button {
  border: 0;
  background: none;
  color: var(--brand-lilac);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  box-shadow: none;
}
.sidebar .link-button:hover { color: #fff; }
.nav-backdrop { display: none; }

.sidebar-head { display: flex; align-items: center; gap: 6px; }
.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { background: rgba(255, 255, 255, 0.16); }
.sidebar-toggle-btn svg { width: 16px; height: 16px; fill: currentColor; }

.sidebar-reopen-tab {
  display: none;
  position: fixed;
  top: 18px;
  left: 0;
  z-index: 30;
  width: 34px;
  height: 34px;
  border-radius: 0 10px 10px 0;
  background: var(--brand-dark);
  color: #fff;
  border: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
}
.sidebar-reopen-tab svg { width: 16px; height: 16px; fill: currentColor; }
html[data-sidebar="hidden"] .sidebar-reopen-tab { display: flex; }

@media (min-width: 701px) {
  html[data-sidebar="icons"] .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  html[data-sidebar="icons"] .nav p,
  html[data-sidebar="icons"] .nav-label,
  html[data-sidebar="icons"] .brand small,
  html[data-sidebar="icons"] .brand strong,
  html[data-sidebar="icons"] .sidebar-user strong,
  html[data-sidebar="icons"] .sidebar-user small { display: none; }
  html[data-sidebar="icons"] .sidebar { padding-left: 14px; padding-right: 14px; }
  html[data-sidebar="icons"] .nav a { justify-content: center; padding: 12px; }
  html[data-sidebar="icons"] .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  html[data-sidebar="icons"] .brand-logo { max-width: 42px; height: 42px; }
  html[data-sidebar="icons"] .sidebar-head { justify-content: center; }
  html[data-sidebar="icons"] .sidebar-toggle-btn { margin-left: 0; }
  html[data-sidebar="icons"] .sidebar-user { grid-template-columns: 1fr; justify-items: center; text-align: center; }

  html[data-sidebar="hidden"] .app-shell { grid-template-columns: 0px minmax(0, 1fr); }
  html[data-sidebar="hidden"] .sidebar { padding: 0; overflow: hidden; border: 0; }
}
@media (max-width: 700px) {
  .sidebar-toggle-btn, .sidebar-reopen-tab { display: none !important; }
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 68px;
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.nav-open-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  place-content: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-open-btn span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--brand-dark);
  border-radius: 2px;
}
.topbar-search {
  flex: 1;
  min-width: 0;
}
.topbar-search input {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--line);
  background: var(--canvas);
  border-radius: 999px;
  padding: 11px 16px 11px 18px;
  font: inherit;
  color: var(--ink);
}
.topbar-search input:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 30%, white);
  border-color: var(--brand);
  background: #fff;
}
.topbar-context {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}
.topbar-alert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  color: var(--brand-dark);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}
.topbar-alert svg { width: 18px; height: 18px; color: var(--brand); }
.topbar-alert:hover {
  border-color: var(--brand-lilac);
  background: var(--brand-soft);
}
.alert-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-coral);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
}
.topbar-sucursal {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-caja { flex-shrink: 0; }
.scan-form { display: grid; gap: 12px; margin-top: 12px; }
.scan-camera { margin-top: 18px; }
.scan-camera video {
  display: none;
  width: 100%;
  max-height: 240px;
  background: #1a0b12;
  border-radius: 12px;
}
.scan-camera video.is-on { display: block; }
.qr-box-lg img { width: 180px; height: 180px; }
.qr-box-lg small { display: block; margin-top: 6px; word-break: break-all; font-size: 11px; }
.consulta-card .stats { grid-template-columns: 1fr 1fr; margin-top: 16px; }

.main { min-width: 0; flex: 1; }
.page { padding: 28px 32px 40px; max-width: 1500px; margin: auto; }

.page-header,
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 7px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 11px;
  font-weight: 800;
  color: var(--brand);
}
h1, h2 {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--ink);
}
h1 { font-size: clamp(28px, 3vw, 32px); color: var(--heading); }
h2 { font-size: 18px; color: var(--section); }
.muted { color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat,
.card {
  background: #FFFFFF;
  border: 1px solid var(--ls-line);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.stat {
  position: relative;
  overflow: hidden;
  padding-left: 22px;
}
.stat:before {
  content: "";
  position: absolute;
  inset: 12px auto 12px 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand);
}
.stat:nth-child(2):before { background: var(--brand-lilac); }
.stat:nth-child(3):before { background: var(--brand-coral); }
.stat:nth-child(4):before { background: var(--brand-dark); }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.alert-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-lilac);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.alert-banner strong,
.alert-banner small { display: block; }
.alert-banner small { color: var(--muted); margin-top: 4px; }
.alert-banner.warning { border-left-color: var(--brand); }
.alert-banner.critical { border-left-color: var(--brand-coral); background: #FFF5F6; }
.alert-banner.quiet { border-left-color: var(--brand-lilac); box-shadow: none; }

.two-columns,
.split { grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr); }
.section-gap { margin-top: 24px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}
.btn.primary,
button[type=submit] {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn.primary:hover,
button[type=submit]:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ver {
  background: #fff;
  border: 1px solid var(--ls-primary-deep);
  color: var(--ls-primary-deep);
}
.btn-editar, .btn.btn-editar {
  background: var(--ls-primary);
  color: #fff;
  border-color: var(--ls-primary);
}
.btn-editar:disabled, .btn-editar[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.danger {
  background: #C62828;
  color: #fff;
  border-color: #C62828;
}
.ver-editar { display: flex; gap: 8px; flex-wrap: wrap; }
/* Las acciones de fila NUNCA se apilan en vertical: con 11 columnas la celda
   nunca alcanza el ancho de los 3 botones con texto (necesita ~242px y recibe
   ~200px incluso a 1600px). La tabla ya hace scroll horizontal (.table-wrap).
   Doble clase para ganarle al flex-wrap de .button-row, definido más abajo. */
.button-row.ver-editar { flex-wrap: nowrap; }
.ver-editar .btn-icon { display: none; width: 17px; height: 17px; flex-shrink: 0; }
.ver-editar .btn-icon svg { width: 100%; height: 100%; }
/* Modo solo-ícono: se activa antes de 1200px porque en ese rango los 3
   botones con texto ya no caben en la celda y quedaban apretados. */
@media (max-width: 1200px) {
  .ver-editar .btn-icon { display: inline-flex; }
  .ver-editar .btn-label { display: none; }
  .ver-editar .btn {
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .button-row.ver-editar {
    gap: 6px;
    justify-content: flex-end;
  }
}
.ficha-lectura { font-size: 16px; line-height: 1.7; }
.ficha-lectura h2 { margin-top: 20px; }
.full { width: 100%; }

.action-list a,
.actions a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 9px;
  background: var(--canvas);
}
.action-list a:hover,
.actions a:hover { border-color: var(--brand-lilac); background: var(--brand-soft); }
.action-list small,
.actions small { display: block; color: var(--muted); margin-top: 3px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}
th {
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
@media (max-width: 1200px) {
  /* Listados densos de móvil hasta laptop angosta: menos aire vertical por
     fila, sin bajar del área táctil cómoda (el botón de acción va en 40px). */
  th, td { padding: 7px 8px; }
  th { font-size: 12px; letter-spacing: 0.04em; }
  .prod-thumb { width: 30px; height: 30px; font-size: 12px; }
  .prod-thumb.prod-ph { font-size: 17px; }
  .prod-table td.prod-actions { padding-left: 4px; }
  .badge { padding: 3px 7px; }
}
.positive, .pos { color: var(--green); font-weight: 700; }
.negative, .neg { color: var(--red); font-weight: 700; }
.empty { text-align: center; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); }

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, #F7D7EA, transparent 42%),
    radial-gradient(circle at bottom left, #FAD4D8, transparent 36%),
    var(--canvas);
}
.login-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(162, 0, 125, 0.12);
}
.login-brand { padding: 0; margin-bottom: 32px; }
.login-page .brand { color: var(--ink); }
.login-page .brand small { color: var(--muted); }
.form-stack { display: grid; gap: 16px; margin-top: 24px; }
.form-stack label { font-size: 13px; font-weight: 700; }
.form-stack input {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}
.alert {
  background: #FFF1F3;
  color: var(--red);
  padding: 11px;
  border-radius: 9px;
}
.technical-link {
  display: block;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 20px;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 40;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .app-shell:has(.nav-open:checked) .sidebar { transform: none; }
  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(59, 36, 48, 0.38);
  }
  .app-shell:has(.nav-open:checked) .nav-backdrop { display: block; }
  .nav-open-btn { display: grid; }
  .nav { display: block; }
  .nav p, .nav-disabled { display: block; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two-columns, .split { grid-template-columns: 1fr; }
  .topbar-alert-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body, .btn, input, select, textarea, th, td, .muted { font-size: 16px !important; }
}

@media (max-width: 600px) {
  .page { padding: 20px 14px; }
  .app-topbar { padding: 10px 14px; }
  .page-header, .topbar { display: block; }
  .page-header .btn, .topbar .btn { margin-top: 15px; }
  .stats { grid-template-columns: 1fr; }
  .alert-banner { flex-direction: column; align-items: flex-start; }
}

.button-row { display: flex; gap: 9px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar input {
  min-width: 280px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
}
.row-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.row-actions a,
.card-title a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}
.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
}
.badge.success { background: #eaf8f1; color: var(--green); }
.badge.warning { background: #F8E7F3; color: var(--brand-dark); }
.muted-badge { color: var(--muted); background: #F6EEF2; }
td small,
.record small { display: block; color: var(--muted); margin-top: 3px; }
.detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.record {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.record:last-child { border: 0; }
.notice {
  background: #eaf8f1;
  color: #126341;
  border: 1px solid #c7ead9;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.notice.error {
  background: #FFF7F8;
  color: #9B1C2A;
  border-color: #F7C7CD;
}
.notice.info, .notice.warning {
  background: #FFF8EE;
  color: var(--ls-primary);
  border-color: var(--ls-line);
}
.caja-meta {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink);
  word-break: break-all;
}
.caja-meta code { font-size: 12px; }
.caja-matches { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.caja-matches a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
}
.caja-matches a span { color: var(--muted); font-size: 12px; }
.danger-zone {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #F7C7CD;
  background: #FFF7F8;
  border-radius: 14px;
}
.btn.danger { color: var(--red); border-color: #F3AAA3; }
.form-card { max-width: 820px; }
.data-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  background: #fff;
}
.field textarea,
.field:has(textarea),
.field:has(input[type=file]) { grid-column: 1 / -1; }
.field-check { flex-direction: row; align-items: center; }
.field-check input { width: auto; }
.field small { color: var(--muted); font-weight: 400; }
.field-error { color: var(--red) !important; }
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.money-row,
.money-total {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.money-row.deduction { color: var(--red); }
.money-total { font-size: 19px; border-bottom: 0; margin-top: 5px; }
.summary {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  margin: 18px 0;
}
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; }
.confirm-box { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }

@media (max-width: 760px) {
  .detail-grid, .data-form { grid-template-columns: 1fr; }
  .toolbar { display: grid; }
  .toolbar input { min-width: 0; }
  .danger-zone { align-items: flex-start; flex-direction: column; }
}

.ai-disclosure {
  padding: 17px 19px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
}
.ai-disclosure p { margin: 5px 0 0; color: #FAD9EC; }
.ai-layout { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr); }
.capability-grid { display: grid; gap: 8px; margin-top: 17px; }
.capability {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.capability-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
}
.capability small { display: block; color: var(--muted); margin-top: 3px; }
.badge.critical { background: #FFF0F2; color: var(--brand-coral); }
.empty-state { text-align: center; padding: 35px; color: var(--muted); }
.empty-state strong { color: var(--ink); }

@media (max-width: 900px) {
  .ai-layout { grid-template-columns: 1fr; }
}

.loyalty-levels { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.level-stat {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 17px;
  box-shadow: var(--shadow);
}
.level-stat:before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--level-color);
}
.level-stat span,
.level-stat small { display: block; color: var(--muted); }
.level-stat strong { display: block; font-size: 25px; margin: 5px 0; }
.level-badge {
  color: var(--level-color);
  background: color-mix(in srgb, var(--level-color) 12%, white);
  border: 1px solid color-mix(in srgb, var(--level-color) 24%, white);
}
.customer-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: #fff;
  border-radius: 20px;
  padding: 26px;
  background: linear-gradient(125deg, var(--level-color), var(--brand-dark));
  box-shadow: 0 16px 35px color-mix(in srgb, var(--level-color) 24%, transparent);
}
.customer-hero p,
.customer-hero h2 { margin: 0 0 5px; }
.customer-hero .points { text-align: right; }
.customer-hero .points strong,
.customer-hero .points span { display: block; }
.customer-hero .points strong { font-size: 38px; }
.progress-heading { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress-track {
  height: 10px;
  overflow: hidden;
  background: #F6EEF2;
  border-radius: 999px;
}
.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-coral));
  border-radius: 999px;
}
.loyalty-card {
  width: min(640px, 100%);
  margin: 10px auto;
  padding: 28px;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.25), transparent 25%),
    linear-gradient(135deg, var(--level-color), var(--brand-dark) 78%);
  box-shadow: 0 25px 60px color-mix(in srgb, var(--level-color) 30%, transparent);
}
.loyalty-brand { display: flex; align-items: center; gap: 10px; }
.loyalty-brand strong,
.loyalty-brand small { display: block; }
.loyalty-brand strong { font-family: var(--font-display); }
.loyalty-person { margin: 42px 0 28px; }
.loyalty-person p { font-size: 10px; letter-spacing: 0.15em; }
.loyalty-person h2 { font-size: 31px; color: #fff; }
.loyalty-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.loyalty-bottom > div > strong,
.loyalty-bottom > div > span { display: block; }
.loyalty-bottom > div > strong { font-size: 34px; }
.qr-box {
  background: #fff;
  padding: 8px;
  border-radius: 13px;
  color: #333;
  text-align: center;
}
.qr-box img { display: block; width: 115px; height: 115px; }
.qr-box small { font-size: 9px; }
.loyalty-progress-card { width: min(640px, 100%); margin: 18px auto; }
.level-rules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rule-card { border-top: 5px solid var(--level-color); }

@media (max-width: 1000px) {
  .loyalty-levels { grid-template-columns: repeat(3, 1fr); }
  .level-rules { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 650px) {
  .loyalty-levels, .level-rules { grid-template-columns: 1fr; }
  .customer-hero { align-items: flex-start; flex-direction: column; }
  .customer-hero .points { text-align: left; }
  .loyalty-card { padding: 20px; }
  .loyalty-person { margin: 30px 0; }
  .qr-box img { width: 90px; height: 90px; }
}

.stat small { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; font-weight: 600; }
.ops-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.ops-filters label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.ops-filters input,
.ops-filters select {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}
.ops-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ops-mini { text-decoration: none; }
.ops-mini strong { display: block; font-size: 28px; margin: 8px 0 4px; letter-spacing: -0.03em; }
.ops-mini small { color: var(--muted); }
.ops-chart { position: relative; height: 240px; }
.ops-tablist { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.ops-tablist button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.ops-tablist button.is-on {
  background: var(--brand-dark);
  color: #fff;
  border-color: var(--brand-dark);
}
.ops-gauges { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 8px; }
.ops-gauge { display: flex; gap: 14px; align-items: center; }
.ops-gauge p { margin: 0; font-weight: 700; }
.ops-gauge small { color: var(--muted); font-weight: 600; }
.ring {
  --pct: 0;
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--ls-line) 0);
  display: grid;
  place-items: center;
}
.ring:after {
  content: "";
  position: absolute;
  inset: 12px;
  background: #fff;
  border-radius: 50%;
}
.ring strong { position: relative; z-index: 1; font-size: 16px; }
.ops-mix {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ops-mix small { display: block; color: var(--muted); }
.ops-mix-bar {
  height: 10px;
  background: #F6EEF2;
  border-radius: 999px;
  overflow: hidden;
}
.ops-mix-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-lilac));
  border-radius: 999px;
}
@media (max-width: 1000px) {
  .ops-cards, .ops-gauges { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .ops-cards, .ops-gauges, .stats { grid-template-columns: 1fr; }
  .ops-mix { grid-template-columns: 1fr; }
}

/* --- Dashboard: acentos modernos (misma paleta vino/magenta) --- */
@keyframes lsRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.grid.stats .stat,
.ops-cards .ops-mini,
.ops-gauges .ops-gauge {
  animation: lsRise 0.45s ease both;
}
.grid.stats .stat:nth-child(2), .ops-cards .ops-mini:nth-child(2) { animation-delay: .05s; }
.grid.stats .stat:nth-child(3), .ops-cards .ops-mini:nth-child(3) { animation-delay: .1s; }
.grid.stats .stat:nth-child(4), .ops-cards .ops-mini:nth-child(4) { animation-delay: .15s; }

.stat { transition: transform .25s ease, box-shadow .25s ease; }
.stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--brand) 20%, transparent);
}
.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 35%, transparent);
}
.stat-icon svg { width: 18px; height: 18px; fill: #fff; }
.stat:nth-child(2) .stat-icon { background: linear-gradient(135deg, var(--brand-lilac), var(--brand)); }
.stat:nth-child(3) .stat-icon { background: linear-gradient(135deg, var(--brand-coral), var(--brand)); }
.stat:nth-child(4) .stat-icon { background: linear-gradient(135deg, var(--brand-dark), var(--section)); }

.stat strong { font-variant-numeric: tabular-nums; }
.sparkline { display: block; width: 100%; height: 30px; margin-top: 10px; overflow: visible; }
.sparkline .area { fill: color-mix(in srgb, var(--brand) 16%, transparent); stroke: none; }
.sparkline .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sparkline circle { fill: var(--brand); }

.ops-chart {
  background: radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--brand) 5%, transparent), transparent 60%);
  border-radius: 12px;
}

/* --- Mi sucursal: actividad semanal (no financiera) --- */
.week-activity { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 6px 0 18px; }
.week-donut { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.week-donut-label {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.week-donut-label strong { font-size: 24px; color: var(--brand-dark); line-height: 1; }
.week-donut-label small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.week-strip { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 220px; }
.week-chip { flex: 1 1 40px; min-width: 0; text-align: center; border-radius: 10px; padding: 8px 2px; background: #F6EEF2; }
.week-chip small { display: block; font-weight: 700; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.week-chip span { display: block; font-size: 11px; font-weight: 700; margin-top: 4px; color: var(--ink); }
.week-chip.is-work { background: color-mix(in srgb, var(--brand) 14%, white); }
.week-chip.is-rest { background: var(--ls-line); }
.week-chip.is-today { box-shadow: 0 0 0 2px var(--brand); }
.week-chip.is-empty { opacity: .5; }

.mini-chip-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.mini-chip {
  display: flex; align-items: center; gap: 10px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px;
  text-decoration: none; color: inherit; flex: 1; min-width: 180px;
}
.mini-chip-icon {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: grid; place-items: center;
}
.mini-chip-icon svg { width: 16px; height: 16px; fill: #fff; }
.mini-chip strong { display: block; font-size: 13px; }
.mini-chip small { color: var(--muted); font-size: 11px; }

.ring { transition: box-shadow .3s ease; }
.ops-gauge:hover .ring { box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand) 14%, transparent); }
.ring strong { font-variant-numeric: tabular-nums; }

.ops-mix-bar i { box-shadow: 0 0 12px color-mix(in srgb, var(--brand) 45%, transparent); }

tr.row-alerta { background: #FFF5F6; }
.badge-bajo {
  display: inline-block;
  background: #FFF5F6;
  color: var(--brand-coral);
  border: 1px solid var(--brand-coral);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
}

.prod-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.prod-toolbar input,
.prod-toolbar select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  min-width: 160px;
}
.prod-toolbar input { flex: 1; min-width: 220px; }
.prod-table th a { color: var(--brand-dark); text-decoration: none; }
.prod-table th:last-child,
.prod-table td.prod-actions { text-align: right; }
.prod-row { cursor: pointer; }
.prod-row:hover { background: var(--brand-soft); }
.prod-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  display: inline-grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
  font-size: 13px;
}
.prod-hero {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 12px;
  display: grid;
  place-items: center;
  min-height: 180px;
  font-size: 42px;
  font-weight: 800;
  color: var(--brand);
  background: var(--brand-soft);
}
/* ---------- Reportes ---------- */
/* Tarjetas de resumen: los tres numeros que encabezan los cuatro reportes. */
.rep-resumen {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.rep-tarjeta {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--brand);
}
.rep-tarjeta .etiqueta {
  display: block;
  font-size: 11px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 6px;
}
.rep-tarjeta .valor {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 30px);
  color: var(--brand-dark);
  line-height: 1.1;
}
.rep-card { margin-bottom: 16px; }
.rep-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.rep-card-head h2 { margin: 0; }
.rep-cuerpo { display: block; }
/* Dona + desglose lado a lado; en pantalla angosta se apilan. */
.rep-cuerpo.con-lateral {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px; align-items: center;
}
.rep-chart { position: relative; height: 320px; }
.rep-chart.dona { height: 300px; }
.rep-chart canvas { max-width: 100%; }

.rep-desglose { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.rep-desglose-fila {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; margin-bottom: 5px;
}
.rep-desglose-fila strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rep-desglose-fila b { color: var(--brand); font-size: 15px; }
.rep-punto { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.rep-barra {
  height: 8px; border-radius: 999px; background: var(--brand-soft);
  overflow: hidden; margin-bottom: 4px;
}
.rep-barra span { display: block; height: 100%; border-radius: 999px; }

.rep-salida {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; flex-wrap: wrap; margin-bottom: 16px;
}
.rep-salida-nota { margin: 2px 0 0; font-size: 13px; }
.rep-salida-botones { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rep-envio { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rep-envio input[type="email"] {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  min-width: 190px;
}
.rep-envio select {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
}
.rep-aviso-correo {
  background: #FFF1D6; color: #8A5200; border: 1px solid #F2D9A8;
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}
@media (max-width: 900px) {
  .rep-resumen { grid-template-columns: 1fr; }
  .rep-cuerpo.con-lateral { grid-template-columns: 1fr; }
  .rep-salida { flex-direction: column; align-items: stretch; }
  .rep-envio input[type="email"] { min-width: 0; flex: 1; }
}

/* Respaldo cuando el producto no tiene foto: el emoji de la categoria. Ocupa
   el mismo recuadro que la foto, solo se agranda la letra. */
.prod-thumb.prod-ph { font-size: 20px; line-height: 1; }
.prod-hero.prod-ph { font-size: 72px; line-height: 1; }
.prod-actions { white-space: nowrap; }
.icon-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--ls-ink);
  text-decoration: none;
  box-sizing: border-box;
}
.icon-btn svg { width: 15px; height: 15px; display: block; }
.icon-btn:hover {
  color: var(--ls-primary-strong);
  border-color: var(--ls-primary-strong);
}
.icon-btn-danger:hover {
  color: var(--ls-coral);
  border-color: var(--ls-coral);
}
.prod-pager {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}
.prod-dl { display: grid; gap: 10px; margin: 0; }
.prod-dl div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.prod-dl dt { color: var(--muted); font-weight: 700; }
.prod-dl dd { margin: 0; font-weight: 700; }

.rich-source { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.rich-wrap {
  grid-column: 1 / -1;
  border: 1px solid var(--ls-line);
  border-radius: 10px;
  background: #fff;
  overflow: visible;
}
.rich-wrap .ql-toolbar.ql-snow {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--ls-line);
  flex-wrap: wrap;
  padding: 8px 10px;
}
.rich-wrap .ql-container.ql-snow { border: 0; font-family: "Open Sans", sans-serif; font-size: 16px; min-height: 180px; }
.rich-wrap .ql-editor { min-height: 160px; font-family: "Open Sans", sans-serif; font-size: 16px; line-height: 1.6; }
.ql-font-open-sans { font-family: "Open Sans", sans-serif; }
.ql-font-inter { font-family: Inter, sans-serif; }
.ql-font-fraunces { font-family: Fraunces, Georgia, serif; }
.ql-font-georgia { font-family: Georgia, serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="open-sans"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="open-sans"]::before { content: "Open Sans"; font-family: "Open Sans", sans-serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="inter"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="inter"]::before { content: "Inter"; font-family: Inter, sans-serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="fraunces"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="fraunces"]::before { content: "Fraunces"; font-family: Fraunces, Georgia, serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="georgia"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="georgia"]::before { content: "Georgia"; font-family: Georgia, serif; }
.ql-snow .ql-picker.ql-header .ql-picker-label::before { content: "Párrafo"; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before { content: "H1"; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before { content: "H2"; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before { content: "H3"; }
.ql-snow .ql-picker.ql-header .ql-picker-item::before { content: "Párrafo"; }
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { content: "H1"; }
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: "H2"; }
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: "H3"; }
.rich-view {
  font-family: "Open Sans", Inter, sans-serif;
  font-size: 18px;
  line-height: 1.7;
  color: var(--ls-ink);
}
.rich-view h1 { font-size: 32px; color: var(--ls-primary-deep); margin: 0 0 12px; }
.rich-view h2 { font-size: 24px; color: var(--ls-primary-strong); margin: 16px 0 10px; }
.rich-view h3 { font-size: 20px; color: var(--ls-primary-strong); margin: 14px 0 8px; }
.rich-view p { margin: 0 0 10px; }
.rich-view ul, .rich-view ol { margin: 0 0 12px 1.2em; }
@media (max-width: 720px) {
  .rich-wrap .ql-toolbar.ql-snow { position: sticky; top: 0; }
  .rich-wrap .ql-toolbar .ql-formats { margin-right: 8px; }
  .rich-wrap .ql-editor { font-size: 16px; }
}
