/* ==========================================================================
   SISTEMA DE GESTIÓN PARA PANADERÍA - ESTILOS PRINCIPALES
   Estética: Moderna, artesanal, cálida y optimizada para mostrador táctil
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Paleta cromática cálida de panadería */
  --primary: #c26910;
  --primary-hover: #a35308;
  --primary-light: #fef3c7;
  --primary-dark: #78350f;
  
  --secondary: #451a03;
  --secondary-surface: #292524;

  --accent: #f59e0b;
  --accent-soft: #fffbeb;

  --bg-app: #fcfaf7;
  --bg-surface: #ffffff;
  --bg-subtle: #f5f2eb;

  --text-main: #1c1917;
  --text-muted: #78716c;
  --text-light: #a8a29e;
  --text-inverse: #ffffff;

  --border-color: #e7e2d9;
  --border-focus: #c26910;

  /* Semáforos de cuenta corriente / cartera */
  --status-ok-bg: #dcfce7;
  --status-ok-text: #15803d;
  --status-warn-bg: #fef3c7;
  --status-warn-text: #b45309;
  --status-danger-bg: #fee2e2;
  --status-danger-text: #b91c1c;

  --shadow-sm: 0 1px 2px rgba(69, 26, 3, 0.05);
  --shadow-md: 0 4px 12px rgba(69, 26, 3, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(69, 26, 3, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ==========================================================================
   TIPOGRAFÍA
   ========================================================================== */

h1, h2, h3, h4, .brand-title {
  font-family: var(--font-heading);
  color: var(--secondary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }

/* ==========================================================================
   LAYOUT Y NAVEGACIÓN
   ========================================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Barra lateral de navegación */
.sidebar {
  width: 260px;
  background-color: var(--secondary);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.brand-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-logo-icon {
  font-size: 2rem;
  background: linear-gradient(135deg, #f59e0b, #c26910);
  border-radius: var(--radius-md);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.brand-info h2 {
  color: #fff;
  font-size: 1.15rem;
  line-height: 1.2;
}

.brand-info span {
  font-size: 0.75rem;
  color: #fcd34d;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}

.nav-links {
  list-style: none;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  color: #e7e5e4;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.nav-link .icon {
  font-size: 1.35rem;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(4px);
}

.nav-link.active {
  background: linear-gradient(90deg, var(--primary), #b45309);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(194, 105, 16, 0.4);
}

.user-profile-bar {
  padding: 1rem 1.25rem;
  background-color: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: #78350f;
  color: #fef3c7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
}

.user-role {
  font-size: 0.72rem;
  color: #d6d3d1;
  text-transform: capitalize;
}

.btn-logout {
  background: transparent;
  border: none;
  color: #fca5a5;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* Área de contenido principal */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

.top-bar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--secondary);
  cursor: pointer;
}

.top-bar-title {
  font-size: 1.35rem;
  color: var(--secondary);
}

.current-date-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
  background-color: var(--primary-light);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.content-body {
  padding: 2rem;
  flex: 1;
}

/* ==========================================================================
   COMPONENTES Y TARJETAS
   ========================================================================== */

.card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

/* Tarjetas de estadísticas / KPI */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 1.35rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: var(--primary);
}

.stat-card.ok::before { background-color: #16a34a; }
.stat-card.warn::before { background-color: #f59e0b; }
.stat-card.danger::before { background-color: #dc2626; }

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.stat-info .stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stat-info .stat-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.2;
}

.stat-info .stat-sub {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* ==========================================================================
   BOTONES Y ACCIONES TÁCTILES GRANDES (Para mostrador)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(194, 105, 16, 0.3);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(194, 105, 16, 0.4);
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--secondary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: #e7e2d9;
}

.btn-success {
  background-color: #16a34a;
  color: #fff;
}

.btn-success:hover {
  background-color: #15803d;
}

.btn-danger {
  background-color: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

/* Botones gigantes para pantalla táctil en POS / mostrador */
.btn-pos-touch {
  padding: 1rem 1.5rem;
  font-size: 1.2rem;
  border-radius: var(--radius-lg);
  font-weight: 700;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn-quick-action {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
  text-decoration: none;
  color: var(--secondary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-quick-action .action-icon {
  font-size: 2.4rem;
}

.btn-quick-action:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  background: #fffdf9;
}

/* ==========================================================================
   TABLAS Y LISTAS
   ========================================================================== */

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.table-modern th {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table-modern td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.table-modern tbody tr:hover td {
  background-color: #faf7f2;
}

/* Semáforos de cuenta corriente / deudas */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-status.ok {
  background-color: var(--status-ok-bg);
  color: var(--status-ok-text);
}

.badge-status.warn {
  background-color: var(--status-warn-bg);
  color: var(--status-warn-text);
}

.badge-status.danger {
  background-color: var(--status-danger-bg);
  color: var(--status-danger-text);
}

/* ==========================================================================
   PUNTO DE VENTA (POS) - FLUJO TÁCTIL EN 3 PASOS
   ========================================================================== */

.pos-container {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  height: calc(100vh - 120px);
}

.pos-catalog-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-categories-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.pos-tab-btn {
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.pos-tab-btn.active, .pos-tab-btn:hover {
  background-color: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}

.pos-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
  overflow-y: auto;
  padding-right: 0.5rem;
  flex: 1;
}

.pos-product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-height: 120px;
}

.pos-product-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.pos-product-card:active {
  transform: scale(0.97);
}

.pos-product-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--secondary);
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.pos-product-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: auto;
}

.pos-product-price {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--primary-dark);
}

.pos-product-stock {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Panel de Orden / Ticket */
.pos-ticket-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.pos-ticket-header {
  padding: 1rem 1.25rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pos-ticket-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem;
}

.pos-ticket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0ebe1;
}

.pos-item-desc {
  flex: 1;
}

.pos-item-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--secondary);
}

.pos-item-price {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pos-item-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-qty {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
}

.pos-item-qty {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.pos-item-subtotal {
  min-width: 80px;
  text-align: right;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--secondary);
}

.btn-remove-item {
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  font-size: 1.1rem;
}

.pos-ticket-footer {
  padding: 1.25rem;
  background: #faf7f2;
  border-top: 1px solid var(--border-color);
}

.pos-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.pos-total-label {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--secondary);
}

.pos-total-amount {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--primary-dark);
}

/* Métodos de Pago Selector */
.payment-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.payment-method-btn {
  padding: 0.8rem 0.5rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s;
}

.payment-method-btn .pm-icon {
  font-size: 1.4rem;
}

.payment-method-btn.active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

/* Alerta de cliente para fiado */
.fiado-client-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ==========================================================================
   MODALES Y FORMULARIOS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(41, 37, 36, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--secondary);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(194, 105, 16, 0.15);
}

/* ==========================================================================
   TOASTS (Notificaciones emergentes)
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
}

.toast {
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  max-width: 420px;
  font-size: 0.92rem;
  border-left: 5px solid var(--primary);
  animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left-color: #16a34a; }
.toast.error { border-left-color: #dc2626; }
.toast.warning { border-left-color: #f59e0b; }

/* ==========================================================================
   CAJA RÁPIDA MOBILE-FIRST & NUMPAD VIRTUAL
   ========================================================================== */

.caja-mobile-wrapper {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-bottom: 5.5rem; /* Espacio para Bottom Nav */
}

/* Switch Tipo: Ingreso / Egreso */
.segmented-switch {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.25rem;
  gap: 0.25rem;
}

.switch-btn {
  flex: 1;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-full);
  border: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  background: transparent;
  color: var(--text-muted);
}

.switch-btn.active-ingreso {
  background: #16a34a;
  color: #fff;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.3);
}

.switch-btn.active-egreso {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
}

/* Visor de Monto Gigante */
.pos-display-card {
  background: #ffffff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: border-color 0.2s;
}

.pos-display-card:focus-within {
  border-color: var(--primary);
}

.pos-display-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.pos-display-amount {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.1;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  word-break: break-all;
}

.pos-display-amount.ingreso { color: #15803d; }
.pos-display-amount.egreso { color: #b91c1c; }

/* Cuadrícula de Categorías Rápidas */
.category-chips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.cat-chip-btn {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  min-height: 68px;
}

.cat-chip-btn .cat-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.cat-chip-btn .cat-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--secondary);
  text-align: center;
  line-height: 1.15;
}

.cat-chip-btn:active {
  transform: scale(0.95);
}

.cat-chip-btn.selected {
  border-color: var(--primary);
  background: #fff8eb;
  box-shadow: 0 0 0 2px var(--primary);
}

.cat-chip-btn.selected .cat-label {
  color: var(--primary-dark);
}

/* Botones de incremento rápido (+500, +1000, +2000) */
.quick-add-row {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.1rem 0;
}

.btn-quick-add {
  flex: 1;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.5rem 0.6rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--secondary);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}

.btn-quick-add:active {
  background: #e7e2d9;
}

/* Teclado Numérico Virtual (Numpad) */
.numpad-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.numpad-key {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 0;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--secondary);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.1s ease;
  min-height: 56px;
}

.numpad-key:active {
  background: var(--primary-light);
  transform: scale(0.96);
  border-color: var(--primary);
}

.numpad-key.action-key {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 1.25rem;
}

/* Selector de Medios de Pago Mobile */
.pay-chips-row {
  display: flex;
  gap: 0.5rem;
}

.pay-chip {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.pay-chip.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* Botón de Confirmación Principal */
.btn-submit-caja {
  width: 100%;
  padding: 1.15rem;
  border-radius: var(--radius-lg);
  border: none;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
  user-select: none;
}

.btn-submit-caja.btn-ingreso {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.btn-submit-caja.btn-egreso {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.btn-submit-caja:active {
  transform: scale(0.98);
}

/* Bottom Navigation Bar (Móvil) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(41, 37, 36, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: none;
  align-items: center;
  justify-content: space-around;
  z-index: 999;
  padding: 0 0.5rem;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  text-decoration: none;
  color: #a8a29e;
  font-size: 0.72rem;
  font-weight: 600;
  flex: 1;
  height: 100%;
  transition: color 0.15s ease;
}

.bottom-nav-item .b-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.bottom-nav-item.active {
  color: #f59e0b;
}

.bottom-nav-item:active {
  transform: scale(0.92);
}

/* ==========================================================================
   HEADER UNIFICADO CON LOGOTIPO & TÍTULOS BAJO EL HEADER
   ========================================================================== */

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.top-bar-logo-badge {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #f59e0b, #c26910);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 2px 6px rgba(194, 105, 16, 0.35);
  flex-shrink: 0;
}

.top-bar-brand-text {
  display: flex;
  flex-direction: column;
}

.top-bar-brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--secondary);
  line-height: 1.15;
}

.top-bar-brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Título de sección bajo el Header */
.page-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.page-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ==========================================================================
   TARJETAS TÁCTILES MOBILE (Reemplazo total de tablas)
   ========================================================================== */

.touch-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.touch-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  position: relative;
}

.touch-card:active {
  background: #fffdf9;
}

.touch-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.touch-card-title {
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.2;
}

.touch-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
  flex-wrap: wrap;
}

.touch-card-body {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.65rem 0;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
  margin: 0.5rem 0;
}

.touch-card-amount-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.touch-card-amount {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.touch-card-amount.danger { color: #dc2626; }
.touch-card-amount.ok { color: #16a34a; }

.touch-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

/* Botón Excel */
.btn-excel {
  background: #107c41;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.95rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(16, 124, 65, 0.25);
  transition: all 0.15s ease;
}

.btn-excel:hover {
  background: #0e6b37;
  color: #fff;
}

.btn-excel:active {
  transform: scale(0.97);
}

/* Tarjetas de Categoría en Reporte */
.cat-report-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.cat-report-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--secondary);
}

.cat-report-val {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
}

/* ==========================================================================
   RESPONSIVO
   ========================================================================== */

@media (max-width: 900px) {
  .bottom-nav {
    display: flex;
  }

  .sidebar {
    display: none; /* En celular el Bottom Nav reemplaza la barra lateral */
  }

  .top-bar {
    padding: 0.65rem 1rem;
  }

  .content-body {
    padding: 0.85rem 0.85rem 5.5rem;
  }

  .mobile-menu-btn {
    display: none;
  }
}

/* ==========================================================================
   PESTAÑAS, GRÁFICOS HISTÓRICOS Y COMPARATIVAS DE CIERRE DE CAJA
   ========================================================================== */

.report-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.3rem;
  margin-bottom: 1.25rem;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}

.report-tab-btn {
  flex: 1;
  padding: 0.65rem 0.75rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.report-tab-btn.active {
  background: var(--secondary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(30, 27, 24, 0.15);
}

/* Chips de selección de períodos (Diario, Semanal, Mensual, Anual, Comparar) */
.period-chips-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

.period-chips-wrapper::-webkit-scrollbar {
  height: 4px;
}
.period-chips-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.period-chips-list {
  display: flex;
  gap: 0.5rem;
  min-width: max-content;
}

.period-chip {
  padding: 0.45rem 0.9rem;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-dark);
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.period-chip:hover {
  background: #e2e8f0;
}

.period-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

/* Filtros contextuales */
.chart-controls-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Contenedor del Gráfico */
.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chart-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-canvas-container {
  position: relative;
  height: 310px;
  width: 100%;
}

@media (max-width: 600px) {
  .chart-canvas-container {
    height: 270px;
  }
}

/* Comparativa de Meses */
.comp-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  align-items: flex-end;
  width: 100%;
}

@media (max-width: 600px) {
  .comp-inputs-grid {
    grid-template-columns: 1fr 1fr;
  }
  .comp-inputs-grid .btn-compare {
    grid-column: 1 / -1;
  }
}

.comparison-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.comparison-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.comp-kpi-header {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comp-kpi-values {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0.2rem;
}

.comp-kpi-current {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
}

.comp-badge {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.comp-badge.up {
  background: #dcfce7;
  color: #15803d;
}

.comp-badge.down {
  background: #fee2e2;
  color: #b91c1c;
}

.comp-badge.neutral {
  background: #f1f5f9;
  color: var(--text-muted);
}

/* Banner de Categoría Más Vendida y Mayor Gasto */
.top-highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.highlight-banner {
  background: linear-gradient(135deg, #ffffff 0%, #fdfbf7 100%);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.highlight-banner.trophy {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.highlight-banner.expense {
  border-color: #fecaca;
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}

.highlight-icon-box {
  font-size: 2rem;
  line-height: 1;
}

.highlight-details {
  flex: 1;
}

.highlight-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.highlight-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.2;
  margin: 0.15rem 0;
}

.highlight-metrics {
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Barra de progreso de participación por categoría */
.cat-rank-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.45rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.cat-rank-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.cat-rank-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--secondary);
}

.cat-rank-val {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
}

.cat-progress-bg {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
}

.cat-progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.cat-progress-fill.green {
  background: #16a34a;
}

.cat-progress-fill.red {
  background: #dc2626;
}

/* Tarjetas de Comparativa de Categorías */
.cat-comp-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 0.45rem;
  box-shadow: var(--shadow-sm);
}

.cat-comp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.cat-comp-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--secondary);
}

.cat-comp-details {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.78rem;
}

@media (max-width: 500px) {
  .cat-comp-details {
    grid-template-columns: 1fr 1fr;
  }
}


