:root {
  /* Paleta base inspirada en Área Técnica */
  --brand-red: #dc2626;
  --brand-red-dark: #b91c1c;

  --bg-body: #020617;
  --bg-surface: #0f172a;
  --bg-surface-soft: #111827;

  --border-soft: #1f2937;
  --border-strong: #334155;

  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --text-strong: #f9fafb;

  --positive: #10b981;
  --negative: #ef4444;

  --accent-blue: #1d4ed8;
}

@view-transition {
  navigation: auto;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: radial-gradient(circle at top, #020617 0%, #020617 40%, #020617 100%);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Utilidad genérica para ocultar elementos */
.hidden {
  display: none !important;
}


/* ================== HEADER / NAV ================== */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.logo-section h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-red);
  margin: 0;
  letter-spacing: -0.5px;
}

.logo-section p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
  font-weight: 300;
}

.nav-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 0.7rem 1.4rem;
  background: #020617;
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.nav-btn:hover {
  background: #0b1120;
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.5);
}

/* Activa: NO se vuelve un bloque rojo, solo un acento sutil */
.nav-btn.active {
  background: #0b1120;
  border-color: var(--brand-red);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.7);
  position: relative;
}

.nav-btn.active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -4px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-red), transparent);
}

/* ================== PANTALLAS ================== */

.screen {
  display: none;
  min-height: calc(100vh - 120px);
}

.screen.active {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.dashboard-container,
.branch-container,
.history-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================== CARDS / RESUMEN ================== */

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition: all 0.25s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.8);
  border-color: var(--border-strong);
}

.card-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0;
}

.card-value.positive {
  color: var(--positive);
}

.card-value.negative {
  color: var(--negative);
}

.section-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-strong);
  margin: 1.5rem 0 1rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border-strong);
}

/* ================== TABLAS ================== */

.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.9);
  flex: 1;
  min-height: 380px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #020617;
}

th {
  padding: 0.9rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 500;
  color: #93a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-strong);
}

td {
  padding: 0.8rem 1rem;
  font-size: 0.875rem;
  color: #d1d5db;
  border-bottom: 1px solid #1f2937;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(15, 23, 42, 0.75);
}

/* BADGES */

.badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.ingreso {
  background: #064e3b;
  color: var(--positive);
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.badge.egreso,
.badge.gasto {
  background: #7f1d1d;
  color: var(--negative);
  border: 1px solid rgba(248, 113, 113, 0.5);
}

.badge.info {
  background: #1e3a8a;
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.5);
}

.badge.warning {
  background: #92400e;
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.5);
}

/* ================== PANTALLA SUCURSAL ================== */

.branch-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.action-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.9);
  transition: all 0.25s ease;
}

.action-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.9);
  border-color: var(--border-strong);
}

.action-card h3 {
  font-size: 1.25rem;
  color: var(--text-strong);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.card-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ================== BOTONES ================== */

.button-group {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Principal: ya no es un bloque rojo, es oscuro con acento sutil */
.primary-btn {
  width: 100%;
  padding: 0.9rem 1.8rem;
  background: #111827;
  border: 1px solid var(--border-strong);
  color: var(--text-strong);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.primary-btn:hover {
  background: #020617;
  border-color: var(--brand-red);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.9);
}

.secondary-btn {
  flex: 1;
  padding: 0.7rem 1.4rem;
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.secondary-btn:hover {
  background: #020617;
  border-color: var(--border-strong);
}

/* ================== STATS RÁPIDOS ================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.stat-item {
  background: rgba(15, 23, 42, 0.8);
  padding: 1.3rem 1.4rem;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
}

.stat-item h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-item p {
  font-size: 1.7rem;
  color: var(--text-strong);
  margin: 0;
  font-weight: 700;
}

.stat-green {
  color: var(--positive);
}

/* ================== FORMULARIOS / MODALES ================== */

.form-group {
  margin-bottom: 1.4rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #d1d5db;
  margin-bottom: 0.45rem;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.75);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-soft);
}

.modal-header h2 {
  font-size: 1.4rem;
  color: var(--text-strong);
  margin: 0;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-strong);
}

/* ================== TOAST ================== */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.9rem 1.3rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  gap: 0.75rem;
  z-index: 2000;
  animation: slideIn 0.3s ease;
}

.toast.active {
  display: flex;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.toast.success .toast-icon {
  background: rgba(16, 185, 129, 0.2);
  color: var(--positive);
}

.toast-message {
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
}

.card-stats {
  margin-top: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #0f172a;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-value {
  font-weight: 600;
  font-size: 0.9rem;
}

.stat-value.positive {
  color: var(--positive);
}

.stat-value.negative {
  color: var(--negative);
}

/* ================== FILTROS HISTORIAL ================== */

.filters-container {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 0;
}

.filter-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-row:first-child {
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 150px;
  flex: 1;
}

.filter-group label {
  font-weight: 500;
  color: #d1d5db;
  font-size: 0.85rem;
}

.filter-input {
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin-left: auto;
}

.filter-actions .primary-btn,
.filter-actions .secondary-btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Summary cards compact (Historial y otros) */

.summary-cards.compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0;
}

.summary-cards.compact .card {
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  text-align: center;
}

.summary-cards.compact .card-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.summary-cards.compact .card-value {
  font-size: 1.3rem;
  font-weight: 600;
}

/* ================== RESPONSIVE GENERAL ================== */

@media (max-width: 768px) {
  .container {
    padding: 1.2rem;
  }

  .header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .nav-buttons {
    width: 100%;
  }

  .nav-btn {
    flex: 1;
    min-width: 140px;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-group {
    min-width: 100%;
  }

  .filter-actions {
    margin-left: 0;
    width: 100%;
    justify-content: stretch;
  }

  .filter-actions .primary-btn,
  .filter-actions .secondary-btn {
    flex: 1;
  }

  .summary-cards.compact {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .summary-cards.compact {
    grid-template-columns: 1fr;
  }

  .filters-container {
    padding: 1rem;
  }

  .branch-actions {
    grid-template-columns: 1fr;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }
}

/* ================== SIDEBAR BOT CAJA ================== */

.bot-sidebar {
  position: fixed;
  top: 0;
  right: -500px;
  width: 500px;
  height: 100vh;
  background: #020617;
  border-left: 1px solid #1f2937;
  z-index: 100;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 18px rgba(0, 0, 0, 0.7);
}

.bot-sidebar.open {
  right: 0;
}

.bot-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #0f172a;
  border-bottom: 1px solid #1f2937;
}

.bot-sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1rem;
}

.bot-sidebar-title .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.bot-sidebar-close {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.bot-sidebar-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.bot-sidebar-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
}

.bot-sidebar-message {
  display: flex;
  gap: 8px;
}

.bot-sidebar-message.user {
  flex-direction: row-reverse;
}

.bot-sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1220;
  border: 1px solid #1f2937;
  font-size: 1rem;
  flex-shrink: 0;
}

.bot-sidebar-bubble {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 14px;
  background: #020617;
  border: 1px solid #1f2937;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.bot-sidebar-message.user .bot-sidebar-bubble {
  background: #1e3a8a;
  border-color: #3b82f6;
}

.bot-sidebar-message-time {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 4px;
}

.bot-sidebar-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-size: 0.85rem;
  margin-top: 8px;
}

.bot-sidebar-typing-dots {
  display: inline-flex;
  gap: 4px;
}

.bot-sidebar-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #6b7280;
  display: inline-block;
  opacity: 0.7;
  animation: blink 1.2s infinite;
}

.bot-sidebar-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.bot-sidebar-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
}

.bot-sidebar-composer {
  padding: 16px;
  border-top: 1px solid #1f2937;
  background: #020617;
}

.bot-sidebar-form {
  display: flex;
  gap: 8px;
}

.bot-sidebar-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  padding: 8px 12px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  outline: none;
}

.bot-sidebar-send {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #20416e;
  background: var(--accent-blue);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bot-sidebar-send:hover:not(:disabled) {
  background: #1e40af;
}

.bot-sidebar-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bot-sidebar-resizer {
  position: absolute;
  left: -4px;
  top: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 101;
}

.bot-sidebar-resizer:hover,
.bot-sidebar-resizer.dragging {
  background: rgba(59, 130, 246, 0.3);
}

/* Botón para abrir la sidebar */
.bot-sidebar-launcher {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: #1e3a8a;
  color: white;
  border: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 8px;
  cursor: pointer;
  z-index: 99;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.bot-sidebar-launcher:hover {
  background: #1e40af;
  padding-right: 12px;
}

.bot-sidebar-launcher-icon {
  font-size: 1.2rem;
}

/* Overlay para cuando está abierta */
.bot-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  z-index: 90;
  display: none;
}

.bot-sidebar-overlay.open {
  display: block;
}

/* Responsive sidebar bot */

@media (max-width: 768px) {
  .bot-sidebar {
    width: 100%;
    right: -100%;
  }

  .bot-sidebar.open {
    right: 0;
  }

  .bot-sidebar-resizer {
    display: none;
  }
}

/* ================== ARQUEO DE CAJA ================== */

.arqueo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.arqueo-panel {
  background: rgba(15, 23, 42, 0.9);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.arqueo-result {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.arqueo-result-label {
  font-size: 0.8rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.arqueo-result-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-strong);
}

.arqueo-result-status {
  font-size: 0.9rem;
  font-weight: 600;
}

.arqueo-result-status.ok {
  color: var(--positive);
}

.arqueo-result-status.faltante {
  color: #f97316;
}

.arqueo-result-status.sobrante {
  color: #22c55e;
}

.table-container.arqueo-table {
  min-height: auto;
}

.field-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #9ca3af;
}

@media (max-width: 900px) {
  .arqueo-grid {
    grid-template-columns: 1fr;
  }
}

/* Detalle de billetes */

.arqueo-billetes-block {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.arqueo-billetes-block .section-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e5e7eb;
  margin-bottom: 0.75rem;
  border-left-color: var(--border-strong);
}

.billete-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.billete-form-row .field {
  flex: 1 1 180px;
}

.billete-form-row label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 0.25rem;
  display: block;
}

.billete-form-row select,
.billete-form-row input {
  width: 100%;
}

#billete-add-btn {
  flex: 0 0 auto;
  padding-inline: 1.25rem;
  height: 40px;
  align-self: flex-end;
}

/* Tabla de billetes */

.billete-table-wrapper {
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 55%);
  overflow: hidden;
}

#billete-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#billete-table thead {
  background: rgba(15, 23, 42, 0.95);
}

#billete-table th,
#billete-table td {
  padding: 0.55rem 0.9rem;
}

#billete-table th {
  font-weight: 600;
  color: #e5e7eb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
}

#billete-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.85);
}

#billete-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.55);
}

/* Botón "Quitar" */

.link-btn {
  border: none;
  background: none;
  color: #f97373;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.link-btn:hover {
  color: #fecaca;
}

/* Total por billetes */

.billete-total-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #9ca3af;
}

.billete-total-row span {
  font-weight: 600;
  color: #22c55e;
}

/* ================== ESTADÍSTICAS DE CAJA (paneles) ================== */

.stats-summary {
  margin-top: 1.5rem;
}

.filters-row.stats-filters {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.stats-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.stats-panel {
  background: #020617;
  border-radius: 0.75rem;
  border: 1px solid #1f2937;
  padding: 1.25rem 1.5rem;
}

/* Panel ancho */
.stats-panel-wide {
  grid-column: 1 / -1;
}

.stats-panel .section-title {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.align-right,
.number-cell {
  text-align: right;
}

#stats-balance.positivo {
  color: var(--positive);
}

#stats-balance.negativo {
  color: var(--negative);
}

.stats-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.stats-panel-header .section-title {
  margin-bottom: 0;
}

.mini-filters {
  display: flex;
  gap: 0.5rem;
}

.mini-filters select {
  background: #020617;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #e5e7eb;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 320px;
}

.stats-panel-wide .chart-wrapper {
  height: 360px;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}
