/* =============================================================================
   ESTILOS TAXSTORE POS V.1 (SISTEMA DE ÍCONOS PLANOS BLANCOS Y NEGROS)
   Paleta de colores oficial:
   --primary: #287094
   --neutral-light: #d4d4ce
   --bg-main: #f6f6f6
   --dark-navy: #023246
   ============================================================================= */

:root {
  --primary: #287094;
  --primary-hover: #1e5572;
  --neutral-light: #d4d4ce;
  --bg-main: #f6f6f6;
  --dark-navy: #023246;
  --dark-navy-surface: #05435c;
  --white: #ffffff;
  --success: #2e7d32;
  --warning: #ed6c02;
  --danger: #d32f2f;
  --text-dark: #023246;
  --text-muted: #64748b;
  --border-color: #d4d4ce;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 4px rgba(2, 50, 70, 0.05);
  --shadow-md: 0 4px 12px rgba(2, 50, 70, 0.08);
  --shadow-lg: 0 10px 25px rgba(2, 50, 70, 0.15);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
}

/* -----------------------------------------------------------------------------
   SISTEMA DE ÍCONOS VECTORIALES PLANOS (BLANCOS EN FONDO OSCURO, NEGROS EN FONDO CLARO)
   ----------------------------------------------------------------------------- */
.nav-icon-white, .icon-flat-white {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-flat-dark {
  width: 20px;
  height: 20px;
  stroke: #023246;
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   LAYOUT GENERAL TAXSTORE POS V.1
   ----------------------------------------------------------------------------- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ENCABEZADO PRINCIPAL (TOP APP BAR) */
.top-app-bar {
  background-color: var(--dark-navy);
  color: var(--white);
  height: 60px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(2, 50, 70, 0.2);
  z-index: 200;
  flex-shrink: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* BOTÓN HAMBURGUESA TOGGLE SWITCH */
.hamburger-btn {
  background: var(--dark-navy-surface);
  border: 1px solid rgba(212, 212, 206, 0.25);
  color: var(--white);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.hamburger-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.05);
}

.app-brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
}

.header-brand-logo {
  height: 32px;
  max-height: 32px;
  width: auto;
  object-fit: contain;
  display: block;
  background: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.app-brand-name {
  letter-spacing: 0.5px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* CUERPO PRINCIPAL (SIDEBAR + MAIN CONTENT) */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* MENÚ LATERAL COLLAPSIBLE */
.sidebar {
  width: 250px;
  background-color: var(--dark-navy-surface);
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 16px;
  box-shadow: 4px 0 15px rgba(2, 50, 70, 0.15);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s ease;
  z-index: 150;
  flex-shrink: 0;
}

/* ESTADO COLAPSADO / OCULTO DEL SIDEBAR */
.sidebar.collapsed {
  margin-left: -250px;
  transform: translateX(-100%);
  pointer-events: none;
}

.sidebar-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  height: 46px;
  min-height: 46px;
  box-sizing: border-box;
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

.nav-item.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 10px rgba(40, 112, 148, 0.3);
}

/* SUB-ITEMS DE CAJA E IMPRESIÓN DIRECTA EN MENÚ LATERAL - MISMO TAMAÑO EXACTO */
.sidebar-pos-subitem,
.sidebar-footer-toggle-wrap {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-footer-toggle-wrap {
  margin-bottom: 12px;
}

.sidebar-pos-subitem .btn-pos-header,
.sidebar-footer-toggle-wrap .btn-pos-header {
  width: 100%;
  height: 46px;
  min-height: 46px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.sidebar-pos-subitem .btn-pos-header:hover,
.sidebar-footer-toggle-wrap .btn-pos-header:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  color: #ffffff !important;
}

.sidebar-pos-subitem .btn-pos-header .sidebar-item-left,
.sidebar-footer-toggle-wrap .btn-pos-header .sidebar-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-pos-subitem .btn-pos-header svg,
.sidebar-footer-toggle-wrap .btn-pos-header svg,
.sidebar-pos-subitem .btn-pos-header .nav-icon-white,
.sidebar-footer-toggle-wrap .btn-pos-header .nav-icon-white {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
  stroke-width: 2px;
  fill: none;
  flex-shrink: 0;
}

.sidebar-pos-subitem .lbl-pos-toggle input[type="checkbox"],
.sidebar-footer-toggle-wrap .lbl-pos-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #22c55e;
  margin: 0;
  flex-shrink: 0;
}

/* PIE DEL MENÚ LATERAL: BOTÓN CERRAR SESIÓN CON ÍCONO PLANO BLANCO */
.sidebar-footer-logout {
  padding-top: 16px;
  border-top: 1px solid rgba(212, 212, 206, 0.2);
}

.sidebar-logout-btn {
  width: 100%;
  background: rgba(211, 47, 47, 0.15);
  border: 1px solid rgba(255, 138, 128, 0.3);
  color: var(--white);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
}

.sidebar-logout-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--white);
}

/* ÁREA PRINCIPAL DE CONTENIDO */
.main-content {
  flex: 1;
  background-color: var(--bg-main);
  overflow-y: auto;
  height: calc(100vh - 60px);
}

.content-section {
  display: none;
  padding: 24px 32px;
  animation: fadeIn 0.25s ease-in-out forwards;
}

.content-section.active {
  display: block;
}

/* Evita que los íconos SVG dentro de los botones intercepten eventos de clic */
button svg,
button svg *,
.btn-primary *,
.btn-edit-sm *,
.btn-danger-sm * {
  pointer-events: none;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 1.6rem;
  color: var(--dark-navy);
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* BADGES DE ESTADO Y ROLES */
.role-tag {
  background: var(--primary);
  color: var(--white);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.network-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.network-badge.online {
  background-color: rgba(46, 125, 50, 0.25);
  color: #81c784;
}

.network-badge.offline {
  background-color: rgba(211, 47, 47, 0.25);
  color: #e57373;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.network-badge.online .status-dot { background-color: #4caf50; }
.network-badge.offline .status-dot { background-color: #f44336; }

/* -----------------------------------------------------------------------------
   PANTALLA LOGIN SPLIT SCREEN (50% / 50%) & RESPONSIVE
   ----------------------------------------------------------------------------- */
#login-view {
  min-height: 100vh;
  width: 100%;
  background: var(--bg-main);
}

.login-split-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.login-left-panel {
  flex: 1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  border-right: 1px solid var(--neutral-light);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
}

.login-logo-box {
  max-width: 360px;
  width: 100%;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand-logo {
  max-width: 100%;
  max-height: 220px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.06));
}

.login-right-panel {
  flex: 1;
  background: linear-gradient(135deg, var(--dark-navy) 0%, #084c67 50%, var(--primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

@media (max-width: 900px) {
  .login-split-wrapper {
    flex-direction: column;
    min-height: 100vh;
  }

  .login-left-panel {
    flex: none;
    padding: 30px 20px;
    border-right: none;
    border-bottom: 1px solid var(--neutral-light);
  }

  .login-brand-logo {
    max-height: 110px;
  }

  .login-right-panel {
    flex: 1;
    padding: 30px 20px;
  }
}

.login-card {
  background: var(--white);
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-badge {
  display: inline-block;
  background: rgba(40, 112, 148, 0.12);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.login-header h1 {
  color: var(--dark-navy);
  font-size: 1.8rem;
}

.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-navy);
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  border: 1.5px solid var(--neutral-light);
  border-radius: var(--radius-sm);
  background-color: #fafafa;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  background-color: var(--white);
  box-shadow: 0 0 0 3px rgba(40, 112, 148, 0.15);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background-color: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.alert-message {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 18px;
  display: none;
}

.alert-danger {
  background-color: #fde8e8;
  color: var(--danger);
  border: 1px solid #f8b4b4;
}

.login-footer-info {
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid var(--neutral-light);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.login-footer-info code {
  background: var(--bg-main);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--dark-navy);
  font-weight: 600;
}

/* -----------------------------------------------------------------------------
   DASHBOARD HERO & STATS
   ----------------------------------------------------------------------------- */
.dash-card-hero {
  background: var(--white);
  border: 1px solid var(--neutral-light);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.dash-icon-flat {
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.stat-box {
  background: var(--bg-main);
  border: 1px solid var(--neutral-light);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: left;
}

.stat-box .title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-box .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 6px;
}

/* -----------------------------------------------------------------------------
   TABLAS Y FORMULARIOS DE CRUD (GESTOR DE PRODUCTOS)
   ----------------------------------------------------------------------------- */
.crud-container {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
}

.card-form-box {
  background: var(--white);
  border: 1px solid var(--neutral-light);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-form-box h3 {
  font-size: 1.1rem;
  color: var(--dark-navy);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-table-box {
  background: var(--white);
  border: 1px solid var(--neutral-light);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.card-table-box h3 {
  font-size: 1.1rem;
  color: var(--dark-navy);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background-color: var(--dark-navy);
  color: var(--white);
  padding: 12px 14px;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eeeeee;
  font-size: 0.9rem;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

/* ALINEACIÓN DE COLUMNAS EN GESTOR DE PRODUCTOS */
.data-table th:nth-child(1), .data-table td:nth-child(1) { text-align: left; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { text-align: left; }
.data-table th:nth-child(3), .data-table td:nth-child(3) { text-align: center; }
.data-table th:nth-child(4), .data-table td:nth-child(4) { text-align: right; }
.data-table th:nth-child(5), .data-table td:nth-child(5) { text-align: right; }
.data-table th:nth-child(6), .data-table td:nth-child(6) { text-align: center; }
.data-table th:nth-child(7), .data-table td:nth-child(7) { text-align: center; }

/* BOTÓN DE EDICIÓN VERDE CON ÍCONO LÁPIZ BLANCO */
.btn-edit-sm {
  background: var(--success);
  color: var(--white);
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-right: 6px;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(46, 125, 50, 0.2);
}

.btn-edit-sm:hover {
  background: #1b5e20;
  transform: scale(1.05);
}

/* BOTÓN DE ELIMINACIÓN CON BOTÓN ROJO E ÍCONO TACHO EN BLANCO */
.btn-danger-sm {
  background: var(--danger);
  color: var(--white);
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(211, 47, 47, 0.2);
}

.btn-danger-sm:hover {
  background: #b71c1c;
  transform: scale(1.05);
}

#pantalla-caja-view {
  padding: 16px 28px;
}

.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  height: calc(100vh - 105px);
}

.pos-main-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pos-top-header .btn-primary,
.pos-top-header .btn-pos-header {
  width: auto;
  margin: 0;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

/* BOTONES DE ACCIÓN DE LA CABECERA OPERATIVA DE CAJA (POS TOP HEADER) */
.btn-pos-header {
  height: 38px;
  padding: 0 14px;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  color: #ffffff !important;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(2, 50, 70, 0.15);
  user-select: none;
  text-decoration: none;
}

.btn-pos-header:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
  box-shadow: 0 4px 8px rgba(2, 50, 70, 0.2);
  color: #ffffff !important;
}

.btn-pos-header:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* Paleta de 3 colores intercalados oficiales Taxstore POS */
.btn-pos-color-1 {
  background-color: #023246 !important;
}

.btn-pos-color-2 {
  background-color: #1E5572 !important;
}

.btn-pos-color-3 {
  background-color: #0284C7 !important;
}

/* Estilo Cierre de Caja / Cancelar (Outline Danger idéntico a Cancelar Venta Actual) */
.pos-top-header .btn-cancel,
.btn-pos-header.btn-cancel {
  background: transparent !important;
  color: var(--danger) !important;
  border: 1px solid var(--danger) !important;
  box-shadow: none !important;
}

.pos-top-header .btn-cancel:hover,
.btn-pos-header.btn-cancel:hover {
  background: #fde8e8 !important;
  color: var(--danger) !important;
  border-color: var(--danger) !important;
  box-shadow: 0 2px 6px rgba(211, 47, 47, 0.15) !important;
}

.pos-top-header .btn-cancel svg,
.btn-pos-header.btn-cancel svg {
  stroke: var(--danger) !important;
}

/* Iconos vectoriales flat SVG */
.btn-pos-header svg {
  width: 15px;
  height: 15px;
  stroke: #ffffff;
  stroke-width: 2.2px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: block;
}

/* Badge numérico para 'En Espera' */
.btn-pos-header .badge-counter {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 800;
  margin-left: 2px;
}

/* Control Toggle 'Impresión Directa' */
.lbl-pos-toggle {
  height: 38px;
  padding: 0 12px 0 14px;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  color: #ffffff !important;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(2, 50, 70, 0.15);
  user-select: none;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.lbl-pos-toggle:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
  box-shadow: 0 4px 8px rgba(2, 50, 70, 0.2);
}

.lbl-pos-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #22c55e;
  margin: 0;
}

.lbl-pos-toggle:has(input[type="checkbox"]:not(:checked)) {
  opacity: 0.75;
  filter: grayscale(0.3);
}

.barcode-search-box {
  background: var(--white);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-light);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.barcode-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  font-size: 1.1rem;
  font-weight: 600;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  outline: none;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-table-container {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-light);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
}

.cart-table th {
  background: var(--dark-navy);
  color: var(--white);
  padding: 12px 14px;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.cart-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

/* REGLAS DE ALINEACIÓN DE TABLA DE CAJA */
.cart-table th:nth-child(1), .cart-table td:nth-child(1) { text-align: left; }
.cart-table th:nth-child(2), .cart-table td:nth-child(2) { text-align: left; }
.cart-table th:nth-child(3), .cart-table td:nth-child(3) { text-align: right; }
.cart-table th:nth-child(4), .cart-table td:nth-child(4) { text-align: center; }
.cart-table th:nth-child(5), .cart-table td:nth-child(5) { text-align: right; }
.cart-table th:nth-child(6), .cart-table td:nth-child(6) { text-align: right; }

.qty-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-qty {
  width: 26px;
  height: 26px;
  border: 1px solid var(--neutral-light);
  background: var(--bg-main);
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.btn-remove {
  color: var(--danger);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
}

.empty-cart-state {
  margin: auto;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-cart-icon {
  margin-bottom: 8px;
}

.pos-sidebar {
  background: var(--white);
  border: 1px solid var(--neutral-light);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.summary-card {
  background: var(--dark-navy);
  color: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.summary-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  opacity: 0.8;
}

.summary-total {
  font-size: 2.6rem;
  font-weight: 800;
  color: #81d4fa;
  margin-top: 4px;
}

.shortcuts-panel {
  background: #f8fafc;
  border: 1px dashed var(--neutral-light);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 20px;
}

.shortcuts-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--dark-navy);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.key-badge {
  background: var(--dark-navy);
  color: var(--white);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.78rem;
}

.pos-actions-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-checkout {
  padding: 13px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.btn-checkout svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2px;
  flex-shrink: 0;
}

.btn-interna { background: var(--primary); color: var(--white); }
.btn-interna:hover { background: var(--primary-hover); }

.btn-arca { background: var(--dark-navy); color: var(--white); }
.btn-arca:hover { background: var(--dark-navy-surface); }

.btn-cancel { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-cancel:hover { background: #fde8e8; }

/* -----------------------------------------------------------------------------
   MODALES Y TOAST
   ----------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(2, 50, 70, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

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

.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  border: 1px solid var(--neutral-light);
  box-shadow: var(--shadow-lg);
}

.receipt-box {
  background: #fdfdfd;
  border: 1px dashed var(--neutral-light);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.85rem;
  margin: 16px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sync-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--dark-navy);
  color: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 999;
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
}

.sync-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* -----------------------------------------------------------------------------
   RESULTADOS DE BÚSQUEDA PREDICTIVA
   ----------------------------------------------------------------------------- */
.search-dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}

.search-dropdown-item:hover, .search-dropdown-item.active {
  background: #f0fdf4;
}

.search-dropdown-item .prod-title {
  font-weight: 700;
  color: var(--dark-navy);
  font-size: 0.88rem;
}

.search-dropdown-item .prod-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-dropdown-item .prod-price {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.95rem;
}

/* -----------------------------------------------------------------------------
   SOPORTE PARA IMPRESIÓN TÉRMICA (80mm / TICKET)
   ----------------------------------------------------------------------------- */
@media print {
  /* Si hay un modal de ticket abierto, aislar la impresión del ticket */
  .modal-overlay.open {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    background: #ffffff !important;
    padding: 0 !important;
    display: block !important;
  }

  body.has-open-modal *:not(.modal-overlay.open):not(.modal-overlay.open *),
  body:has(.modal-overlay.open) *:not(.modal-overlay.open):not(.modal-overlay.open *) {
    display: none !important;
  }

  /* Ocultar elementos de navegación e interactividad durante impresión general */
  .top-app-bar,
  .sidebar,
  .hamburger-btn,
  .btn-primary,
  .btn-info-icon,
  .btn-trigger-info-auditoria,
  .sync-toast {
    display: none !important;
  }

  .modal-overlay.open .modal-card {
    box-shadow: none !important;
    border: none !important;
    width: 80mm !important;
    max-width: 80mm !important;
    padding: 0 !important;
    margin: 0 auto !important;
  }

  .modal-overlay.open button {
    display: none !important;
  }

  .modal-header .modal-icon-success,
  .modal-header svg {
    display: none !important;
  }

  .receipt-box {
    border: none !important;
    padding: 0 !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
  }
}
