/* =========================================================
   GADIX — Global Stylesheet (Modern Edition)
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
:root {
  --clr-primary: #114162;
  --clr-primary-dk: #10507a;
  --clr-primary-lt: #eff6ff;
  --clr-success: #16a34a;
  --clr-warning: #d97706;
  --clr-danger: #dc2626;
  --clr-bg: #f8fafc;
  --clr-surface: #ffffff;
  --clr-sidebar: #0f172a;
  --clr-sidebar-hover: rgba(255, 255, 255, 0.06);
  --clr-sidebar-active: rgba(99, 179, 237, 0.15);
  --clr-text: #0f172a;
  --clr-muted: #64748b;
  --clr-border: #e2e8f0;
  --sidebar-w: 242px;
  --topbar-h: 58px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --font:
    "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Arial, sans-serif;
}
html,
body {
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  background: var(--clr-bg);
  color: var(--clr-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── App Shell ─────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--clr-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.25s;
  /* Sin borde duro — sombra lateral suave */
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.28);
}

/* ── Scrollbar personalizado — sidebar ─────────────────── */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Scrollbar personalizado — contenido principal ──────── */
.main-content::-webkit-scrollbar {
  width: 6px;
}
.main-content::-webkit-scrollbar-track {
  background: transparent;
}
.main-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}
.main-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Scrollbar global (Firefox) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}

.page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar-header {
  padding: 1.1rem 1rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  /* Sutil separador inferior */
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  /* Micro-gradiente para dar profundidad */
  background: rgba(255, 255, 255, 0.03);
  flex-shrink: 0;
}
.sidebar-logo {
  font-size: 1.5rem;
}
/* Logo imagen en sidebar */
.sidebar-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.sidebar-logo-img--custom {
  background: none;
  padding: 0;
  object-fit: fill;
  width: 48px !important;
  height: 48px !important;
}

.sidebar-brand {
  color: #f1f5f9;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

/* ── Perfil del negocio ──────────────────────────────────── */
.perfil-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 700px) {
  .perfil-layout {
    grid-template-columns: 1fr;
  }
}
.perfil-logo-card {
  text-align: center;
}
.perfil-logo-preview {
  width: 160px;
  height: 160px;
  margin: 0 auto 0.75rem;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  overflow: hidden;
  font-size: 3.5rem;
}
.perfil-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sidebar-nav {
  flex: 1;
  padding: 0.6rem 0.6rem 0.5rem;
}
/* ── Separadores de sección ────────────────────────────── */
.nav-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem 0.3rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #475569;
  font-weight: 700;
}
.nav-section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}
/* ── Items de navegación ───────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.48rem 0.7rem;
  color: #94a3b8;
  text-decoration: none;
  cursor: pointer;
  border: none;
  width: 100%;
  background: none;
  font-size: 0.845rem;
  font-weight: 500;
  border-radius: 7px;
  /* Indicador izquierdo — oculto por defecto */
  border-left: 2px solid transparent;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
  margin-bottom: 2px;
  line-height: 1.35;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
}
.nav-item.active {
  background: rgba(99, 179, 237, 0.13);
  color: #7dd3fc;
  font-weight: 600;
  border-left-color: #38bdf8;
}
.nav-item--danger:hover {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
}
.nav-icon {
  font-size: 1rem;
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
  /* Filtro para que los emojis no se vean apagados */
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}
.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0.5rem 0.6rem;
}

/* ── Grupos colapsables del sidebar ───────────────────── */
.nav-group {
  margin-bottom: 2px;
}

/* Botón header del grupo */
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.46rem 0.7rem;
  background: none;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition:
    color 0.15s ease,
    background 0.15s ease;
  line-height: 1;
  user-select: none;
}
.nav-group-toggle:hover {
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
}
/* Cuando el grupo está abierto, el texto del header se ilumina levemente */
.nav-group.open > .nav-group-toggle {
  color: #7dd3fc;
}

/* Línea separadora a la derecha del label */
.nav-group-toggle-label {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chevron animado */
.nav-chevron {
  font-size: 0.75rem;
  color: #475569;
  transition:
    transform 0.22s ease,
    color 0.15s ease;
  flex-shrink: 0;
  margin-left: auto;
  /* Unicode chevron más elegante que ▾ */
  line-height: 1;
}
.nav-group.open > .nav-group-toggle .nav-chevron {
  transform: rotate(90deg);
  color: #7dd3fc;
}

/* Contenedor animado — truco grid para animar altura automática */
.nav-group-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s ease;
}
.nav-group.open > .nav-group-body {
  grid-template-rows: 1fr;
}
.nav-group-inner {
  overflow: hidden;
  /* Pequeño padding izquierdo para indicar jerarquía */
  padding-left: 0.3rem;
}

/* Items dentro de grupo con indent leve y línea vertical */
.nav-group-inner .nav-item {
  padding-left: 0.9rem;
  font-size: 0.82rem;
  margin-bottom: 1px;
  position: relative;
}
.nav-group-inner .nav-item::before {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #334155;
  transition: background 0.15s;
}
.nav-group-inner .nav-item:hover::before,
.nav-group-inner .nav-item.active::before {
  background: #38bdf8;
}
/* El borde izquierdo activo va en el grupo, no en el item */
.nav-group-inner .nav-item.active {
  border-left-color: transparent;
  background: rgba(99, 179, 237, 0.1);
  color: #7dd3fc;
}

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.975rem;
  color: var(--clr-text);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--clr-muted);
}
.session-timer {
  font-size: 0.8rem;
  color: var(--clr-muted);
  font-variant-numeric: tabular-nums;
}
.session-timer.warn {
  color: var(--clr-warning);
  font-weight: 600;
}

/* ── User menu ─────────────────────────────────────────── */
.user-menu {
  position: relative;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  padding: 0.38rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.topbar-user:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.user-chevron {
  color: var(--clr-muted);
  font-size: 0.7rem;
}
.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  min-width: 205px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
}
.user-dropdown.open {
  display: block;
  animation: dropdownIn 0.12s ease;
}
@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.dropdown-header {
  padding: 0.75rem 1rem;
  background: var(--clr-bg);
}
.dropdown-header strong {
  display: block;
  font-size: 0.9rem;
}
.dropdown-header small {
  color: var(--clr-muted);
  font-size: 0.75rem;
}
.dropdown-divider {
  border-top: 1px solid var(--clr-border);
}
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.1s;
}
.dropdown-item:hover {
  background: var(--clr-bg);
}
.dropdown-item-danger {
  color: var(--clr-danger);
}
.dropdown-item-danger:hover {
  background: #fef2f2;
}

/* ── Badges ────────────────────────────────────────────── */
.badge-rol,
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-superadmin {
  background: #7c3aed;
  color: #fff;
}
.badge-admin {
  background: var(--clr-primary);
  color: #fff;
}
.badge-usuario {
  background: #0891b2;
  color: #fff;
}
.badge-success {
  background: #dcfce7;
  color: #15803d;
}
.badge-warning {
  background: #fef9c3;
  color: #a16207;
}
.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}
.badge-info {
  background: #e0f2fe;
  color: #0369a1;
}
.badge-secondary {
  background: #f1f5f9;
  color: #475569;
}

/* ── Turnos detalle modal ───────────────────────────────── */
.turnos-detalle-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.75rem;
}
.dtl-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
}
.dtl-row:nth-child(even) {
  background: var(--clr-bg);
}
.dtl-label {
  color: var(--clr-text-muted);
  flex-shrink: 0;
  min-width: 130px;
}
.dtl-val {
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  overflow-x: scroll;
}
.card h2,
.card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--clr-text);
  font-weight: 600;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition:
    background 0.12s,
    opacity 0.12s;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--clr-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--clr-primary-dk);
}
.btn-secondary {
  background: var(--clr-surface);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}
.btn-secondary:hover {
  background: var(--clr-bg);
}
.btn-danger {
  background: var(--clr-danger);
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
}
.btn-success {
  background: var(--clr-success);
  color: #fff;
}
.btn-success:hover {
  background: #15803d;
}
.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}
.btn-xl {
  padding: 0.85rem;
  font-size: 1.1rem;
  font-weight: 600;
}
.btn-full {
  width: 100%;
  justify-content: center;
}
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--clr-muted);
  font-size: 1.1rem;
  padding: 0.2rem;
  line-height: 1;
  border-radius: 6px;
  transition:
    background 0.1s,
    color 0.1s;
}
.btn-icon:hover {
  background: var(--clr-bg);
  color: var(--clr-text);
}

#btn-login {
  margin-top: 10px;
  font-size: 14px;
  height: 2.5rem;
}
/* ── Forms ─────────────────────────────────────────────── */
.form-control {
  width: 100%;
  height: 2.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--clr-text);
  background: var(--clr-surface);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--clr-muted);
}
.form-group.full {
  grid-column: 1/-1;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

#inp-notas-apertura {
  height: 5rem;
}
/* ── Tables ────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--clr-bg);
  font-size: 0.775rem;
  color: var(--clr-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  border-bottom: 2px solid var(--clr-border);
}
.table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--clr-border);
  vertical-align: middle;
}
.table-hover tbody tr:hover {
  background: #f8fafc;
}
.row-warning td {
  background: #fffbeb;
}
.row-danger td {
  background: #fef2f2;
}

/* ── Alerts ────────────────────────────────────────────── */
.alert {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}
.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.alert-warning {
  background: #fef9c3;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ── Modals ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: var(--clr-surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.15s ease;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.modal-lg {
  max-width: 700px;
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.mt-1 {
  margin-top: 0.75rem;
}

/* ── Confirm dialog ────────────────────────────────────── */
.confirm-box {
  max-width: 400px;
  text-align: center;
  padding: 2rem 1.75rem;
}
.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fef3c7;
  margin: 0 auto 1rem;
  color: #d97706;
}
.confirm-icon svg {
  width: 28px;
  height: 28px;
}
.confirm-box .modal-title {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}
.confirm-msg {
  color: var(--clr-text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.confirm-box .modal-actions {
  justify-content: center;
  gap: 0.75rem;
}
.confirm-box .btn {
  min-width: 110px;
}

/* ── Toolbar ───────────────────────────────────────────── */
.page-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  flex-wrap: wrap;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* ── Dashboard ─────────────────────────────────────────── */
.dash-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.metric-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: var(--shadow);
}
.metric-card--warning {
  border-color: #fde68a;
  background: #fffbeb;
}
.metric-card--danger {
  border-color: #fca5a5;
  background: #fef2f2;
}
.metric-icon {
  font-size: 1.9rem;
  line-height: 1;
  width: 2.5rem;
  text-align: center;
  flex-shrink: 0;
}
.metric-value {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}
.metric-label {
  font-size: 0.78rem;
  color: var(--clr-muted);
  margin-top: 0.25rem;
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

/* ── POS layout ────────────────────────────────────────── */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1rem;
  height: calc(100vh - var(--topbar-h) - 2.5rem);
}
.pos-left {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}
.pos-right {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}
.pos-search-bar {
  position: relative;
}
.pos-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
}
.pos-search-item {
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--clr-border);
}
.pos-search-item:last-child {
  border-bottom: none;
}
.pos-search-item:hover {
  background: var(--clr-bg);
}
.pos-search-item .item-stock {
  font-size: 0.75rem;
  color: var(--clr-muted);
}
.pos-cart-card {
  flex: 1;
  min-height: 0;
}
.pos-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.pos-empty {
  color: var(--clr-muted);
  text-align: center;
  padding: 2rem;
  font-size: 0.875rem;
}
.pos-cart-table td,
.pos-cart-table th {
  padding: 0.4rem 0.5rem;
}
.inp-qty {
  width: 60px;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  text-align: center;
  font-size: 0.875rem;
}
.pos-totals {
  flex-shrink: 0;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--clr-border);
  font-size: 0.9rem;
}
.total-row--grand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--clr-primary);
  border-bottom: none;
  padding-top: 0.5rem;
}
.inp-descuento {
  width: 100px;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  font-size: 0.875rem;
  text-align: right;
}
.metodos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.metodo-btn {
  padding: 0.5rem;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s;
}
.metodo-btn.selected {
  border-color: var(--clr-primary);
  background: var(--clr-primary-lt);
  color: var(--clr-primary);
}
.cambio-box {
  background: var(--clr-bg);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
}
.inp-lg {
  font-size: 1.1rem;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
}
.cli-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  margin-top: 0.4rem;
}

/* Turno banner */
.turno-banner {
  background: #ecfdf5;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}
.turno-form {
  max-width: 500px;
}

/* ── Ticket / Print ────────────────────────────────────── */
.ticket-box {
  max-width: 380px;
}
.ticket-header {
  text-align: center;
  margin-bottom: 1rem;
}
.ticket-logo {
  font-size: 1.3rem;
  font-weight: 700;
}
.ticket-folio {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0.25rem 0;
}
.ticket-items {
  width: 100%;
  font-size: 0.825rem;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
}
.ticket-items th,
.ticket-items td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px dashed var(--clr-border);
}
.ticket-totals {
  border-top: 2px solid var(--clr-text);
  padding-top: 0.5rem;
}
.ticket-row {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  font-size: 0.875rem;
}
.ticket-row--total {
  font-weight: 700;
  font-size: 1rem;
  border-top: 1px dashed var(--clr-border);
  padding-top: 0.4rem;
}
.ticket-footer {
  text-align: center;
  margin-top: 0.75rem;
  color: var(--clr-muted);
  font-size: 0.8rem;
}

/* ── Reports grid ──────────────────────────────────────── */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.rpt-summary {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.rpt-kpi {
  text-align: center;
}
.rpt-kpi strong {
  display: block;
  font-size: 1.3rem;
}
.rpt-kpi span {
  font-size: 0.75rem;
  color: var(--clr-muted);
}

/* ── Category list ─────────────────────────────────────── */
.cat-list {
  list-style: none;
  margin-top: 0.75rem;
}
.cat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--clr-border);
  font-size: 0.875rem;
}

/* ── Utilities ─────────────────────────────────────────── */
.text-center {
  text-align: center;
}
.text-muted {
  color: var(--clr-muted);
}
.text-right {
  text-align: right;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 149;
}

/* ── Login page ────────────────────────────────────────── */
@keyframes login-fade-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* El body recibe el fondo como fallback para que no haya
   ningún color extraño visible en ningún browser móvil */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: #0f172a;
}

/* ── Enlace de términos en el login ──────────────────────── */
.login-legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.72rem;
  color: var(--clr-muted);
}
.login-legal-links a {
  color: var(--clr-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.login-legal-links a:hover {
  color: var(--clr-primary);
}

/* ── Páginas legales (Términos / Privacidad) ─────────────── */
.legal-card {
  background: var(--clr-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  position: relative;
  z-index: 1;
  overflow: hidden;
  animation: login-fade-up 0.4s cubic-bezier(0.22, 0.68, 0, 1.2) both;
}

/* Acento superior igual que login-card */
.legal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--clr-primary),
    #2d8ccc,
    var(--clr-primary)
  );
  border-radius: 0 0 4px 4px;
}

.legal-header {
  padding: clamp(1.5rem, 4vw, 2rem) clamp(1.5rem, 4vw, 2.5rem) 1rem;
  border-bottom: 1px solid var(--clr-border);
  text-align: center;
}
.legal-header .login-logo {
  margin-bottom: 1rem;
}
.legal-title {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 700;
  color: var(--clr-text);
  margin: 0 0 0.25rem;
}
.legal-meta {
  font-size: 0.78rem;
  color: var(--clr-muted);
  margin: 0;
}

.legal-body {
  padding: clamp(1.25rem, 4vw, 2rem) clamp(1.5rem, 4vw, 2.5rem);
  max-height: 58vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border) transparent;
}
.legal-body::-webkit-scrollbar {
  width: 5px;
}
.legal-body::-webkit-scrollbar-thumb {
  background: var(--clr-border);
  border-radius: 3px;
}

.legal-section {
  margin-bottom: 1.5rem;
}
.legal-section h2 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--clr-primary);
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.legal-section p,
.legal-section li {
  font-size: 0.875rem;
  color: var(--clr-text-secondary, var(--clr-muted));
  line-height: 1.7;
}
.legal-section ul {
  padding-left: 1.25rem;
  margin: 0.4rem 0 0;
}
.legal-section li {
  margin-bottom: 0.25rem;
}

.legal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.25rem clamp(1.5rem, 4vw, 2.5rem);
  border-top: 1px solid var(--clr-border);
  background: rgba(0, 0, 0, 0.06);
}
.legal-link {
  font-size: 0.82rem;
  color: var(--clr-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.legal-link:hover {
  color: var(--clr-primary);
}

@media (max-width: 500px) {
  .legal-body {
    max-height: 52vh;
    padding: 1rem 1.25rem;
  }
  .legal-header {
    padding: 1.25rem 1.25rem 0.75rem;
  }
  .legal-footer {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .legal-footer .btn {
    width: 100%;
    text-align: center;
  }
}

/* Wrapper real — overflow:hidden en un div funciona en todos
   los browsers móviles, a diferencia de hacerlo en body */
.login-bg {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #0f172a 0%, #114162 45%, #1d6a9a 100%);
  position: relative;
  overflow: hidden;
  padding: 1.5rem 1rem;
}

/* Decoración: imagen rotada (derecha, escritorio) */
.login-bg::before {
  content: "";
  position: absolute;
  background: url("../img/bgimage.png") center / cover no-repeat;
  opacity: 0.12;
  transform: rotate(-35deg) scale(1.1);
  width: 80%;
  height: 120%;
  right: -40%;
  top: -10%;
  border-radius: 40px;
  pointer-events: none;
}

/* Mancha de luz azul inferior-izquierda */
.login-bg::after {
  content: "";
  position: absolute;
  width: min(420px, 90vw);
  height: min(420px, 90vw);
  background: radial-gradient(
    circle,
    rgb(45 140 204 / 50%) 0%,
    transparent 70%
  );
  bottom: -120px;
  left: -100px;
  pointer-events: none;
}

.login-card {
  background: var(--clr-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 5vw, 2.5rem);
  width: 100%;
  max-width: 400px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  position: relative;
  z-index: 1;
  animation: login-fade-up 0.45s cubic-bezier(0.22, 0.68, 0, 1.2) both;
}

/* Acento de color en la parte superior de la tarjeta */
.login-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 10%;
  right: 10%;
  height: 8px;
  background: linear-gradient(
    90deg,
    var(--clr-primary),
    #2d8ccc,
    var(--clr-primary)
  );
  border-radius: 0 0 15px 15px;
}
.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: 700;
  color: var(--clr-text);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo img {
  max-width: 180px;
  height: auto;
  display: inline-block;
}

.login-subtitle {
  text-align: center;
  color: var(--clr-muted);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

/* Responsive: pantallas pequeñas (< 500px) */
@media (max-width: 500px) {
  .login-bg {
    padding: 1.25rem 0.875rem;
  }
  .login-card {
    border-radius: var(--radius);
    padding: 1.5rem 1.25rem;
  }
  .login-card::before {
    left: 5%;
    right: 5%;
  }
  .login-logo {
    margin-bottom: 1.25rem;
  }
  .login-logo img {
    max-width: 150px;
    width: 100%;
  }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 150;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-toggle {
    display: block;
  }
  .sidebar-overlay.open {
    display: block;
  }
  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .pos-right {
    order: -1;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .dash-metrics {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 480px) {
  .dash-metrics {
    grid-template-columns: 1fr;
  }
  .main-content {
    padding: 0.75rem;
  }
}

/* ── Print / Impresora térmica ──────────────────────────── */
@media print {
  /* Ocultar todo excepto el ticket */
  body > *:not(#__print-area) {
    display: none !important;
  }
  #__print-area {
    display: block !important;
  }

  body,
  #__print-area {
    margin: 0;
    padding: 0;
    background: #fff;
    font-family: "Courier New", Courier, monospace;
    font-size: 11pt;
    color: #000;
  }

  /* Ancho de papel: se sobreescribe desde JS según configuración */
  .ticket-print {
    width: var(--ticket-width, 80mm);
    margin: 0 auto;
    padding: 2mm 3mm;
  }

  .ticket-print .tkt-logo {
    text-align: center;
    font-size: 13pt;
    font-weight: bold;
    border-bottom: 1px dashed #000;
    padding-bottom: 2mm;
    margin-bottom: 2mm;
  }
  .ticket-print .tkt-negocio {
    text-align: center;
    font-size: 10pt;
    margin-bottom: 1mm;
  }
  .ticket-print .tkt-meta {
    font-size: 9pt;
    margin-bottom: 2mm;
    border-bottom: 1px dashed #000;
    padding-bottom: 2mm;
  }
  .ticket-print .tkt-meta div {
    margin: 0;
  }

  .ticket-print table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5pt;
    margin-bottom: 2mm;
  }
  .ticket-print th {
    border-bottom: 1px solid #000;
    text-align: left;
    padding: 0.5mm 0;
  }
  .ticket-print td {
    padding: 0.5mm 0;
    vertical-align: top;
  }
  .ticket-print td:last-child,
  .ticket-print th:last-child {
    text-align: right;
  }

  .ticket-print .tkt-totals {
    border-top: 1px dashed #000;
    padding-top: 1mm;
    font-size: 9.5pt;
  }
  .ticket-print .tkt-totals div {
    display: flex;
    justify-content: space-between;
    margin: 0.5mm 0;
  }
  .ticket-print .tkt-grand {
    font-size: 13pt;
    font-weight: bold;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    margin: 1mm 0;
    padding: 1mm 0;
  }
  .ticket-print .tkt-cambio {
    font-size: 10pt;
  }
  .ticket-print .tkt-footer {
    text-align: center;
    font-size: 9pt;
    border-top: 1px dashed #000;
    margin-top: 2mm;
    padding-top: 2mm;
  }
  .ticket-print .tkt-metodo {
    font-size: 9pt;
    margin-bottom: 1mm;
  }

  /* Ocultar botones en impresión */
  .modal-actions,
  button,
  nav,
  header,
  aside {
    display: none !important;
  }

  @page {
    margin: 0;
    size: auto;
  }
}

/* ── Config POS (modal) ─────────────────────────────────── */
.pos-config-btn {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  transition: box-shadow 0.15s;
}
.pos-config-btn:hover {
  box-shadow: var(--shadow-lg);
}

.scanner-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  margin-right: 5px;
  transition: background 0.15s;
}
.scanner-indicator.active {
  background: #16a34a;
}

.config-section {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-text-muted);
  margin: 0.75rem 0 0.35rem;
}

/* ── Scroll Animations ───────────────────────────────── */
.fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .fade-up {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
