:root {
  --bg: #000000;
  --panel: #090b0f;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.25);
  --text: #f9fafb;
  --muted: #9ca3af;
  --accent: #fbbf24;
  --danger: #ef4444;
  --shadow-soft: 0 24px 80px rgba(0, 0, 0, 0.9);
  --radius-lg: 18px;
  --radius-md: 12px;

  /* 🔥 NUEVO (solo para resaltar cajas sin cambiar colores) */
  --panel-strong: rgba(18, 18, 18, 0.92);
  --panel-edge: rgba(251, 191, 36, 0.14);
  --glow: 0 0 0 1px rgba(251, 191, 36, 0.10), 0 18px 60px rgba(0,0,0,0.85);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

/* ✅ EVITA overflow horizontal */
html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Roboto", sans-serif;
  background: radial-gradient(circle at top, #111111 0, #020202 45%, #000000 100%);
  color: var(--text);

  /* ✅ EVITA que se salga por texto largo */
  overflow-x: hidden;
}

/* Vistas */
.view {
  width: 100%;
  min-height: 100vh;
}

.view-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.hidden {
  display: none !important;
}

/* Tarjetas */
.card {
  background: radial-gradient(circle at top left, #111111, #020202);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 24px 26px;
  max-width: 520px;
  width: 100%;

  /* 🔥 NUEVO: leve borde dorado para resaltar */
  outline: 1px solid rgba(251, 191, 36, 0.10);
  outline-offset: -1px;
}

.card-pin,
.card-auth {
  max-width: 420px;
}

/* Branding */
.brand-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.brand-logo-wrap {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  padding: 3px;
  background: conic-gradient(from 210deg, #262626, #fbbf24, #fde68a, #262626);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.55);
}

.brand-logo-wrap.small {
  width: 44px;
  height: 44px;
  padding: 2px;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.45);
}

.brand-logo {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
  background: #000000;
}

.brand-text-wrap h1,
.brand-text-wrap .app-name {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-text-wrap p,
.brand-text-wrap .app-subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Botones */
.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: radial-gradient(circle at top left, #fde68a, #fbbf24, #b45309);
  color: #111827;
  box-shadow:
    0 0 0 1px rgba(248, 250, 252, 0.08),
    0 18px 50px rgba(251, 191, 36, 0.6);
}

.btn-primary:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow:
    0 0 0 1px rgba(248, 250, 252, 0.12),
    0 24px 70px rgba(251, 191, 36, 0.85);
}

.btn-secondary {
  background: linear-gradient(135deg, #171717, #020202);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-outline {
  background: rgba(15, 15, 15, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
}

.btn-outline:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.45);
}

.btn-danger {
  background: radial-gradient(circle at top, #ef4444, #7f1d1d);
  color: #fee2e2;
}

.btn-danger:hover {
  box-shadow: 0 14px 42px rgba(239, 68, 68, 0.7);
}

.btn-google {
  width: 100%;
  background: #f5f5f5;
  color: #111827;
}

.btn-google:hover {
  background: #e5e5e5;
}

.btn-text {
  background: transparent;
  color: var(--muted);
  padding-inline: 10px;
}

.btn-text:hover {
  color: var(--accent);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Campos */
.field-group {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 6px;
  color: var(--muted);
}

.field-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(12, 12, 12, 0.9);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;

  /* ✅ evita overflow en inputs en grid */
  min-width: 0;
}

.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.5);
}

.field-input.small {
  padding: 6px 8px;
  font-size: 0.8rem;
}

textarea.field-input {
  resize: vertical;
}

.msg-error {
  color: #fecaca;
  font-size: 0.8rem;
  margin-top: 6px;
}

.msg-info {
  color: var(--muted);
  font-size: 0.8rem;
}

.msg-info.small {
  font-size: 0.75rem;
}

/* Layout / topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(22px);
  background: linear-gradient(120deg, #000000, #090909);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1.2fr);
  align-items: center;

  /* ✅ evita que algo empuje el grid */
  min-width: 0;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0; /* ✅ */
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0; /* ✅ */
}

.app-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0; /* ✅ */
}

.app-name {
  font-weight: 600;
  cursor: text;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px dashed transparent;

  /* ✅ texto largo no rompe */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-name:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(17, 17, 17, 0.9);
}

.topbar-center {
  display: flex;
  justify-content: center;
  gap: 8px;

  /* ✅ si hay muchas pestañas, no rompe */
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.nav-btn {
  border-radius: 999px;
  padding: 6px 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 0 0 auto; /* ✅ */
}

.nav-btn:hover {
  color: var(--accent);
}

.nav-btn-active {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.7);
  color: #fefce8;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.55);
}

.user-info {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 0; /* ✅ */
}

.user-email {
  max-width: 220px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Páginas */
.layout-main {
  padding: 16px;

  /* ✅ evita que el contenido cree overflow */
  max-width: 100%;
  overflow-x: hidden;
}

.page {
  display: none;
}

.active-page {
  display: block;
}

.panel {
  /* 🔥 Ajuste mínimo: panel más “visible” sin cambiar look Nexus */
  background: linear-gradient(180deg, var(--panel-strong), rgba(5,5,5,0.96));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--glow);
  padding: 18px 18px 16px;

  /* ✅ */
  min-width: 0;
}

.panel h2 {
  margin-top: 0;
}

.wide {
  max-width: 1040px;
  margin: 0 auto;
}

/* Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap; /* ✅ por si en algún momento se aprieta */
}

/* Historial tabla */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap; /* ✅ evita desbordes */
}

.panel-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap; /* ✅ */
}

/* ✅ CLAVE: evitar que la tabla rompa el borde */
.table-wrap {
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: auto;
  max-height: 360px;

  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;

  /* ✅ si hay muchas columnas, scroll horizontal dentro del wrap */
  min-width: 760px;
}

.data-table thead {
  background: linear-gradient(120deg, rgba(251, 191, 36, 0.25), rgba(12, 12, 12, 0.98));
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(30, 30, 30, 0.95);
  white-space: nowrap; /* ✅ */
}

.data-table tbody tr:nth-child(even) {
  background: rgba(10, 10, 10, 0.96);
}

.data-table tbody tr:hover {
  background: rgba(251, 191, 36, 0.15);
}

/* Filtros */
.filters-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  align-items: end;
}

.filter-group label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.filter-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap; /* ✅ */
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  background: #000000;
}

/* Utilidades */
.mt-4 { margin-top: 8px; }

/* Responsive */
@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr;
    row-gap: 10px;
  }
  .topbar-left,
  .topbar-right {
    justify-content: space-between;
  }
  .topbar-center {
    justify-content: flex-start;
  }
  .filters-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .user-email {
    max-width: 160px;
  }

  /* ✅ tabla más flexible en pantallas pequeñas */
  .data-table { min-width: 680px; }
}

/* ========== CAJA (RESUMEN) ========== */

.caja-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.caja-card {
  border-radius: 16px;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);

  /* 🔥 más contraste para que se vea “caja” */
  background: linear-gradient(180deg, rgba(18,18,18,0.92), rgba(5,5,5,0.96));
  box-shadow: var(--glow);
}

.caja-card h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.caja-amount {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.caja-card.cash .caja-amount {
  color: #fef08a;
}

.caja-card.total {
  border-color: rgba(251,191,36,0.7);
  box-shadow: 0 0 24px rgba(251,191,36,0.6);
}

.caja-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(255,255,255,0.03);
}

@media (max-width: 960px) {
  .caja-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .caja-summary-grid {
    grid-template-columns: 1fr;
  }
}
