/* ==========================================================================
   Mi Tiendita - sistema de diseno
   Componentes comunes (botones, tarjetas, formularios, tablas, avisos) y el
   armazon de la aplicacion (barra lateral, barra superior, navegacion movil).
   Tailwind se usa para el acomodo de cada pagina; aqui va lo que se repite.
   ========================================================================== */

:root {
  --brand-50: #ecf8f9;
  --brand-100: #d0eef1;
  --brand-200: #a5dde3;
  --brand-500: #168e9c;
  --brand-600: #0e7a87;
  --brand-700: #0f626d;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e6e9ee;
  --border-strong: #d5dae1;
  --text: #1c2430;
  --text-soft: #5b6676;
  --text-muted: #8b95a3;

  --success: #16a34a;
  --success-bg: #eaf7ee;
  --danger: #dc2626;
  --danger-bg: #fdecec;
  --warning: #d97706;
  --warning-bg: #fef4e4;
  --info: #2563eb;
  --info-bg: #eaf1fe;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 16px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);

  --sidebar-w: 248px;
  --topbar-h: 68px;
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Armazon
   -------------------------------------------------------------------------- */
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform .25s ease;
}

.app-sidebar__brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.15rem 1.25rem;
  min-height: var(--topbar-h);
}

.app-sidebar__brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--brand-50);
}

.app-sidebar__nav {
  flex: 1;
  /* Sin esto, en flex el menu no se encoge y el recuadro de abajo lo tapa */
  min-height: 0;
  overflow-y: auto;
  padding: .5rem .85rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.nav-group {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 1rem .75rem .4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .62rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}

.nav-item i { width: 20px; text-align: center; font-size: .95rem; color: var(--text-muted); transition: color .15s ease; }
.nav-item:hover { background: #f3f5f7; color: var(--text); }
.nav-item:hover i { color: var(--brand-600); }
.nav-item.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav-item.is-active i { color: var(--brand-600); }

/* En pantallas bajas el menu tiene prioridad sobre el recuadro */
@media (max-height: 860px) { .sidebar-cta { display: none; } }

.sidebar-cta {
  margin: .5rem .85rem 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--brand-50), #f5fbfc);
  border: 1px solid var(--brand-100);
  text-align: center;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.5rem;
  background: rgba(244, 246, 248, .85);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}

.app-topbar.is-scrolled { border-bottom: 1px solid var(--border); }

.app-main { min-height: 100vh; }

.app-content {
  padding: .5rem 1.5rem 2.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .82rem;
  background: #fde9a8;
  color: #6b4e00;
  flex-shrink: 0;
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .4rem;
  opacity: 0;
  transform: translateY(-4px) scale(.98);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 60;
}

.dropdown.is-open { opacity: 1; transform: none; pointer-events: auto; }

.dropdown a, .dropdown button {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .6rem .7rem;
  border-radius: 8px;
  font-size: .88rem;
  color: var(--text);
  text-align: left;
}

.dropdown a:hover, .dropdown button:hover { background: #f3f5f7; }
.dropdown i { width: 18px; color: var(--text-muted); }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .4);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.sidebar-overlay.is-open { opacity: 1; pointer-events: auto; }

/* Navegacion inferior en moviles */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: none;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(16, 24, 40, .05);
}

.bottom-nav a, .bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: .4rem 0;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 10px;
}

.bottom-nav i { font-size: 1.1rem; }
.bottom-nav .is-active { color: var(--brand-600); }

.bottom-nav .bottom-nav__pos {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  margin-top: -22px;
  border-radius: 999px;
  background: var(--brand-600);
  color: #fff;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(14, 122, 135, .35);
  font-size: 0;
}

.bottom-nav .bottom-nav__pos i { font-size: 1.25rem; }

@media (min-width: 1024px) {
  .app-main { margin-left: var(--sidebar-w); }
  .only-mobile { display: none !important; }
}

@media (max-width: 1023.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
  .app-topbar { padding: 0 1rem; }
  .app-content { padding: .25rem 1rem calc(88px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: flex; align-items: flex-end; }
  .only-desktop { display: none !important; }
}

/* --------------------------------------------------------------------------
   Encabezado de pagina
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.page-subtitle { color: var(--text-soft); font-size: .92rem; margin-top: .25rem; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .35rem;
}

.breadcrumb a:hover { color: var(--brand-600); }

/* --------------------------------------------------------------------------
   Tarjetas
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.card-title { font-weight: 700; font-size: 1rem; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  background: var(--brand-50);
  color: var(--brand-600);
}

.stat-card__icon.is-success { background: var(--success-bg); color: var(--success); }
.stat-card__icon.is-danger { background: var(--danger-bg); color: var(--danger); }
.stat-card__icon.is-warning { background: var(--warning-bg); color: var(--warning); }
.stat-card__icon.is-info { background: var(--info-bg); color: var(--info); }

.stat-card__label { font-size: .8rem; color: var(--text-soft); font-weight: 500; }
.stat-card__value { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }

.tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.tile:hover { border-color: var(--brand-200); box-shadow: var(--shadow); transform: translateY(-2px); }

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  height: 42px;
  padding: 0 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .05s ease;
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .7; cursor: not-allowed; }

.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 1px 2px rgba(14, 122, 135, .3); }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); }

.btn-outline { background: var(--surface); color: var(--brand-700); border-color: var(--brand-200); }
.btn-outline:hover:not(:disabled) { background: var(--brand-50); border-color: var(--brand-500); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: #f6f7f9; }

.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: #eceff3; color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-sm { height: 34px; padding: 0 .8rem; font-size: .82rem; border-radius: 8px; }
.btn-lg { height: 50px; padding: 0 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  color: var(--text-soft);
  background: transparent;
}

.btn-icon:hover { background: #eceff3; color: var(--text); }
.btn-icon.is-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-icon.is-brand:hover { background: var(--brand-50); color: var(--brand-600); }

.spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  display: inline-block;
  animation: girar .7s linear infinite;
}

@keyframes girar { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Formularios
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .4rem; }
.label { font-size: .85rem; font-weight: 600; color: var(--text); }
.label .opt { font-weight: 400; color: var(--text-muted); }
.hint { font-size: .78rem; color: var(--text-muted); }

.input, .select, .textarea {
  width: 100%;
  height: 44px;
  padding: 0 .9rem;
  font-size: .92rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.textarea { height: auto; min-height: 96px; padding: .7rem .9rem; resize: vertical; }

.select {
  appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95a3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
}

.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(22, 142, 156, .14);
}

.input:disabled, .select:disabled { background: #f3f5f7; color: var(--text-muted); }

.field.has-error .input, .field.has-error .select { border-color: var(--danger); }
.field-error { font-size: .78rem; color: var(--danger); }

/* Campo con icono a la izquierda (buscadores) */
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; pointer-events: none; }
.input-icon > .input { padding-left: 2.5rem; }

/* Interruptor */
.switch { position: relative; display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s ease; flex-shrink: 0; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s ease; }
.switch input:checked + .switch__track { background: var(--brand-600); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand-500); outline-offset: 2px; }

.checkbox { width: 18px; height: 18px; accent-color: var(--brand-600); }

/* --------------------------------------------------------------------------
   Tablas. En moviles, con .table-stack, cada fila se vuelve una tarjeta y
   cada celda muestra su data-label.
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }

.table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #f8fafb; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }

@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  /* Nombre y acciones en la primera linea; el resto debajo, a todo lo ancho */
  .table-stack tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .5rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
  .table-stack tbody td { grid-column: 1 / -1; }
  .table-stack tbody td.cell-main { grid-column: 1; grid-row: 1; }
  .table-stack tbody td.actions { grid-column: 2; grid-row: 1; }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack tbody td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table-stack tbody td::before { content: attr(data-label); font-weight: 600; color: var(--text-soft); font-size: .8rem; text-align: left; }
  .table-stack tbody td[data-label=""]::before, .table-stack tbody td:not([data-label])::before { content: none; }
  .table-stack tbody td.cell-main { font-size: 1rem; padding-bottom: .35rem; text-align: left; }
  .table-stack tbody td.actions { justify-content: flex-end; padding: 0; }
  .table-stack .num { text-align: right; }
}

/* --------------------------------------------------------------------------
   Insignias, chips y estados vacios
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: #eef1f4;
  color: var(--text-soft);
  white-space: nowrap;
}

.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .8; }
.badge.no-dot::before { content: none; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-brand { background: var(--brand-50); color: var(--brand-700); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  height: 34px;
  padding: 0 .9rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
  transition: all .15s ease;
}

.chip:hover { border-color: var(--brand-500); color: var(--brand-700); }
.chip.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-soft);
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 1.5rem;
}

.empty-state h3 { font-weight: 700; color: var(--text); font-size: 1.05rem; margin-bottom: .25rem; }

.alert {
  display: flex;
  gap: .75rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  border: 1px solid transparent;
}

.alert-info { background: var(--info-bg); color: #1e40af; border-color: #d4e2fd; }
.alert-warning { background: var(--warning-bg); color: #92400e; border-color: #fbe2b8; }
.alert-danger { background: var(--danger-bg); color: #991b1b; border-color: #f9d0d0; }
.alert-success { background: var(--success-bg); color: #166534; border-color: #c8ebd3; }

/* Esqueleto de carga */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, #eceff3 25%, #f6f7f9 37%, #eceff3 63%);
  background-size: 400% 100%;
  animation: brillo 1.3s ease infinite;
}

@keyframes brillo { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}

@media (max-width: 1023.98px) {
  .toast-stack { top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); right: 50%; transform: translateX(50%); }
}

.toast {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  animation: toast-entra .25s cubic-bezier(.2, .9, .3, 1.2);
}

.toast.is-leaving { animation: toast-sale .2s ease forwards; }

.toast__icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .9rem;
}

.toast--success .toast__icon { background: var(--success-bg); color: var(--success); }
.toast--error .toast__icon { background: var(--danger-bg); color: var(--danger); }
.toast--warning .toast__icon { background: var(--warning-bg); color: var(--warning); }
.toast--info .toast__icon { background: var(--info-bg); color: var(--info); }

.toast__body { flex: 1; padding-top: .25rem; line-height: 1.35; }
.toast__title { font-weight: 700; margin-bottom: .1rem; }
.toast__close { color: var(--text-muted); padding: .2rem; border-radius: 6px; }
.toast__close:hover { color: var(--text); background: #f1f3f5; }

.toast__bar { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .35; animation: toast-bar linear forwards; }
.toast--success .toast__bar { color: var(--success); }
.toast--error .toast__bar { color: var(--danger); }
.toast--warning .toast__bar { color: var(--warning); }
.toast--info .toast__bar { color: var(--info); }

@keyframes toast-entra { from { opacity: 0; transform: translateY(-8px) scale(.97); } }
@keyframes toast-sale { to { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes toast-bar { from { width: 100%; } to { width: 0; } }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity .18s ease;
}

.modal-backdrop.is-open { opacity: 1; }

.modal {
  width: min(440px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.98);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.2);
}

.modal-lg { width: min(720px, 100%); }
.modal-backdrop.is-open .modal { transform: none; }

@media (max-width: 639.98px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { width: 100%; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

.modal__icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  background: var(--brand-50);
  color: var(--brand-600);
}

.modal__icon.is-danger { background: var(--danger-bg); color: var(--danger); }
.modal__icon.is-warning { background: var(--warning-bg); color: var(--warning); }

/* --------------------------------------------------------------------------
   Barra de progreso de navegacion
   -------------------------------------------------------------------------- */
.nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 110;
  background: linear-gradient(90deg, var(--brand-500), #5fd0dc);
  box-shadow: 0 0 8px rgba(22, 142, 156, .5);
  opacity: 0;
  transition: width .3s ease, opacity .3s ease;
}

.nav-progress.is-active { opacity: 1; }

/* Aparicion suave del contenido */
.fade-in { animation: aparece .3s ease both; }
/* Solo opacidad: un transform convertiria a main en el contenedor de los
   position: fixed de cada pagina (barras y hojas inferiores del POS). */
@keyframes aparece { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Impresion: solo el contenido */
@media print {
  .app-sidebar, .app-topbar, .bottom-nav, .toast-stack, .nav-progress, .no-print { display: none !important; }
  .app-main { margin: 0 !important; }
  body { background: #fff; }
}
