/* =====================================================
   TicketPro — Tema "Ficha"
   Fondo blanco hueso · botones morado degradado
   ===================================================== */
:root {
  --hueso: #F6F3EC;          /* fondo general */
  --blanco: #FFFFFF;         /* tarjetas */
  --tinta: #241B33;          /* texto principal */
  --tinta-suave: #6E6580;    /* texto secundario */
  --morado: #7C3AED;
  --morado-oscuro: #4C1D95;
  --lavanda: #EFE9FB;        /* fondos de acento */
  --linea: #E6E0D4;          /* bordes sobre hueso */
  --exito: #178A50;
  --peligro: #C93A3A;
  --ambar: #B8860B;
  --grad: linear-gradient(135deg, var(--morado), var(--morado-oscuro));
  --radio: 14px;
  --sombra: 0 1px 2px rgba(36,27,51,.06), 0 8px 24px rgba(36,27,51,.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--hueso);
  color: var(--tinta);
  font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1, h2, h3, .marca { font-family: "Sora", "Inter", system-ui, sans-serif; }
a { color: var(--morado); text-decoration: none; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; cursor: pointer; border-radius: 10px;
  padding: 10px 18px; font: 600 14px "Inter", system-ui, sans-serif;
  transition: transform .08s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-primario {
  background: var(--grad); color: #fff;
  box-shadow: 0 4px 14px rgba(124,58,237,.32);
}
.btn-primario:hover { filter: brightness(1.08); }
.btn-primario:active { transform: translateY(1px); }
.btn-borde {
  background: var(--blanco); color: var(--morado-oscuro);
  border: 1.5px solid var(--morado); box-shadow: none;
}
.btn-borde:hover { background: var(--lavanda); }
.btn-peligro { background: #FBEDED; color: var(--peligro); }
.btn-peligro:hover { background: #F5D9D9; }
.btn-mini { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:focus-visible { outline: 3px solid rgba(124,58,237,.4); outline-offset: 2px; }

/* ---------- Login / Registro: tarjeta tipo ficha ---------- */
.pantalla-centro {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(600px 300px at 85% -10%, rgba(124,58,237,.10), transparent 70%),
    radial-gradient(500px 260px at 0% 100%, rgba(76,29,149,.08), transparent 70%),
    var(--hueso);
}
.ficha-card {
  position: relative; width: 100%; max-width: 420px;
  background: var(--blanco); border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 36px 34px 30px;
}
/* muescas laterales de ticket perforado */
.ficha-card::before, .ficha-card::after {
  content: ""; position: absolute; top: 92px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--hueso);
}
.ficha-card::before { left: -11px; }
.ficha-card::after  { right: -11px; }
.ficha-card .linea-punteada {
  border-top: 2px dashed var(--linea); margin: 22px -34px 24px;
}
.marca {
  font-size: 22px; font-weight: 700; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 10px;
}
.marca .punto {
  width: 34px; height: 34px; border-radius: 9px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-size: 17px;
}
img.punto { width: 34px; height: 34px; border-radius: 50%; background: #fff; object-fit: cover; padding: 0; }
.sidebar .marca img.punto { background: #fff; }
.sub { color: var(--tinta-suave); font-size: 13.5px; margin-top: 4px; }

/* ---------- Formularios ---------- */
.campo { margin-bottom: 16px; }
.campo label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.campo input, .campo select {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1.5px solid var(--linea); background: #FDFCF9;
  font: 14.5px "Inter", system-ui, sans-serif; color: var(--tinta);
}
.campo input:focus, .campo select:focus {
  outline: none; border-color: var(--morado);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.ayuda { font-size: 12.5px; color: var(--tinta-suave); margin-top: 4px; }

/* ---------- Layout del panel ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--grad); color: #fff; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar .marca { color: #fff; margin-bottom: 20px; padding: 0 10px; }
.sidebar .marca .punto { background: rgba(255,255,255,.18); }
.sidebar a {
  color: rgba(255,255,255,.82); padding: 10px 12px; border-radius: 9px;
  font-weight: 500; font-size: 14px; display: flex; gap: 10px; align-items: center;
}
.sidebar a:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar a.activo { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.sidebar .abajo { margin-top: auto; border-top: 1px solid rgba(255,255,255,.18); padding-top: 10px; }

.contenido { padding: 26px 30px; max-width: 1200px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.topbar h1 { font-size: 21px; margin: 0; letter-spacing: -.02em; }
.topbar .quien { font-size: 13px; color: var(--tinta-suave); }

/* ---------- Tarjetas y estadísticas ---------- */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card {
  background: var(--blanco); border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 18px 20px;
}
.stat .num { font-family: "Sora", sans-serif; font-size: 26px; font-weight: 700; }
.stat .eti { font-size: 12.5px; color: var(--tinta-suave); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat.morado { background: var(--grad); color: #fff; }
.stat.morado .eti { color: rgba(255,255,255,.75); }

/* ---------- Tablas ---------- */
.tabla-envoltura { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); overflow: auto; }
table.tabla { width: 100%; border-collapse: collapse; min-width: 640px; }
.tabla th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--tinta-suave); padding: 13px 16px; border-bottom: 1.5px solid var(--hueso);
}
.tabla td { padding: 13px 16px; border-bottom: 1px solid var(--hueso); font-size: 14px; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr:hover td { background: #FBF9F4; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.badge-ok    { background: #E4F4EB; color: var(--exito); }
.badge-mal   { background: #FBEDED; color: var(--peligro); }
.badge-gris  { background: var(--hueso); color: var(--tinta-suave); }
.badge-lav   { background: var(--lavanda); color: var(--morado-oscuro); }
.badge-ambar { background: #F8F0DC; color: var(--ambar); }

/* ---------- Avisos ---------- */
.aviso { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.aviso-ok  { background: #E4F4EB; color: var(--exito); }
.aviso-mal { background: #FBEDED; color: var(--peligro); }

/* ---------- Modal ---------- */
.modal-fondo {
  position: fixed; inset: 0; background: rgba(36,27,51,.45);
  display: none; place-items: center; padding: 20px; z-index: 50;
}
.modal-fondo.abierto { display: grid; }
.modal {
  background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra);
  width: 100%; max-width: 480px; padding: 26px; max-height: 92vh; overflow: auto;
}
.modal h2 { margin: 0 0 18px; font-size: 18px; }
.modal .acciones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.fila-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vacio { text-align: center; color: var(--tinta-suave); padding: 46px 20px; }
.vacio .icono { font-size: 34px; margin-bottom: 8px; }

/* ---------- Responsive ---------- */
/* ---------- Barra superior móvil ---------- */
.barra-movil { display: none; }
.menu-fondo { display: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }

  .barra-movil {
    display: flex; align-items: center; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; height: 58px;
    background: var(--grad); color: #fff; padding: 0 14px; z-index: 60;
    box-shadow: 0 2px 12px rgba(36,27,51,.18);
  }
  .barra-movil .hamburguesa {
    width: 40px; height: 40px; border: 0; border-radius: 11px; cursor: pointer;
    background: rgba(255,255,255,.16); color: #fff;
    display: grid; place-items: center; padding: 0; flex-shrink: 0;
  }
  .barra-movil .hamburguesa span {
    display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px;
    position: relative; transition: transform .2s ease, background .2s ease;
  }
  .barra-movil .hamburguesa span::before,
  .barra-movil .hamburguesa span::after {
    content: ""; position: absolute; left: 0; width: 18px; height: 2px;
    background: #fff; border-radius: 2px; transition: transform .2s ease;
  }
  .barra-movil .hamburguesa span::before { top: -6px; }
  .barra-movil .hamburguesa span::after  { top: 6px; }
  .barra-movil .hamburguesa.abierta span { background: transparent; }
  .barra-movil .hamburguesa.abierta span::before { transform: translateY(6px) rotate(45deg); }
  .barra-movil .hamburguesa.abierta span::after  { transform: translateY(-6px) rotate(-45deg); }
  .barra-movil .marca { font-size: 17px; color: #fff; }
  .barra-movil .marca img.punto { width: 30px; height: 30px; }

  /* Sidebar como panel deslizante */
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 258px; z-index: 70;
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    overflow-y: auto; padding: 18px 12px; box-shadow: 6px 0 26px rgba(36,27,51,.25);
  }
  .sidebar.abierto { transform: translateX(0); }
  .sidebar a { padding: 13px 12px; font-size: 15px; }

  .menu-fondo {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(36,27,51,.5); opacity: 0; pointer-events: none;
    transition: opacity .22s ease;
  }
  .menu-fondo.visible { opacity: 1; pointer-events: auto; }

  .contenido { padding: 74px 14px 24px; }
  .topbar { margin-bottom: 16px; }
  .topbar h1 { font-size: 19px; }
  .fila-2 { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .card { padding: 15px 16px; }
  .stat .num { font-size: 22px; }
  .btn { padding: 11px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}


/* ---------- Preloader (estrella con anillo degradado giratorio) ---------- */
#precarga {
  position: fixed; inset: 0; z-index: 999;
  background: var(--hueso);
  display: grid; place-items: center;
  transition: opacity .45s ease;
}
#precarga.fuera { opacity: 0; pointer-events: none; }
.precarga-centro { display: grid; place-items: center; gap: 18px; }
.precarga-anillo { position: relative; width: 92px; height: 92px; }
.precarga-anillo::before {
  content: ""; position: absolute; inset: -11px; border-radius: 50%;
  background: conic-gradient(from 0deg, #2196F3, #7C3AED, #4C1D95, rgba(76,29,149,0) 72%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  animation: precarga-girar 1.1s linear infinite;
}
.precarga-anillo img {
  width: 92px; height: 92px; border-radius: 50%; display: block;
  animation: precarga-latido 2.2s ease-in-out infinite;
}
.precarga-texto {
  font: 600 13px "Inter", system-ui, sans-serif; color: var(--tinta-suave);
  letter-spacing: .14em; text-transform: uppercase;
}
@keyframes precarga-girar { to { transform: rotate(360deg); } }
@keyframes precarga-latido { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) {
  .precarga-anillo::before, .precarga-anillo img { animation: none; }
}
