/* Sorteos Paseo Metrópoli — hoja única para el sitio público y la administración */

:root {
  --navy: #1B2A4A;
  --navy-2: #2A3D66;
  --gold: #C8A15A;
  --gold-2: #E2C88F;
  --gold-soft: #F6EEDC;
  --cream: #FAF7F1;
  --paper: #FFFFFF;
  --ink: #1C2333;
  --muted: #5E6678;
  --faint: #8B92A3;
  --line: #E7E1D5;
  --line-2: #F0EBE1;
  --ok: #17734A;
  --ok-soft: #E4F4EC;
  --err: #B42318;
  --err-soft: #FDECEA;
  --warn: #8A5A00;
  --warn-soft: #FFF4DB;
  --primary: var(--navy);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(27, 42, 74, .06), 0 8px 24px rgba(27, 42, 74, .08);
  --shadow-lg: 0 2px 4px rgba(27, 42, 74, .06), 0 20px 48px rgba(27, 42, 74, .14);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
p { margin: 0 0 1rem; }
.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85em; word-break: break-all; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* ---------- Sitio público ---------- */

.pub-header {
  display: flex; justify-content: center; align-items: center;
  padding: 18px 16px 6px;
}
.marca { display: inline-block; text-decoration: none; line-height: 0; }
.marca img { height: 64px; width: auto; }
.marca-blanco img { height: 48px; }

.pub-main { width: 100%; max-width: 560px; margin: 0 auto; padding: 8px 16px 40px; }

.hero {
  position: relative; overflow: hidden;
  border-radius: 20px;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--primary) 70%, #fff 0%) 0%, var(--primary) 55%, color-mix(in srgb, var(--primary) 80%, #000) 100%);
  color: #fff;
  padding: 22px 22px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px;
  border-radius: 50%; border: 18px solid rgba(226, 200, 143, .25);
}
.hero-banner { margin: -22px -22px 16px; aspect-ratio: 16 / 7; object-fit: cover; width: calc(100% + 44px); max-width: none; }
.hero h1 { font-size: 1.45rem; font-weight: 800; margin: 0 0 4px; position: relative; z-index: 1; }
.hero .premio { color: var(--gold-2); font-weight: 600; position: relative; z-index: 1; margin: 0; }
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; position: relative; z-index: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; font-weight: 600;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 1.25rem; font-weight: 800; }
.card-lead { color: var(--muted); margin-bottom: 18px; }

.saludo {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--gold-soft); border-radius: var(--radius-sm);
}
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 800;
}
.saludo strong { display: block; }
.saludo .linkish { font-size: .85rem; }

.pasos { display: flex; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.pasos li { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.pasos li.hecho { background: var(--gold); }
.pasos li.actual { background: var(--primary); }
.paso-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }

/* Formularios */
.field { margin-bottom: 18px; }
.field > label:not(.check):not(.upload), .label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.label-opt { font-weight: 500; color: var(--faint); }
.hint { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%;
  font: inherit; font-size: 1.05rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  min-height: 52px;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
textarea.input { min-height: 96px; resize: vertical; }
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235E6678' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.input::placeholder { color: #A9AFBC; }
.input-error { border-color: var(--err) !important; }
.error { color: var(--err); font-size: .86rem; font-weight: 600; margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.input-prefix > .input { padding-left: 34px; }
.input-big { font-size: 1.3rem; font-weight: 700; letter-spacing: .02em; }
.monto-estado { font-size: .85rem; font-weight: 600; margin-top: 6px; }
.monto-estado.ok { color: var(--ok); }
.monto-estado.bajo { color: var(--warn); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; background: var(--line-2); border-radius: 12px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  text-align: center; padding: 10px 6px; border-radius: 9px; cursor: pointer;
  font-weight: 700; font-size: .92rem; color: var(--muted); margin: 0;
}
.seg input:checked + label { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg input:focus-visible + label { outline: 2px solid var(--primary); }

.check {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: .93rem; line-height: 1.45;
}
.check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }
.check:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 4%, #fff); }
.check-destacado { border-color: var(--gold); background: #FFFCF5; }
.check-destacado:has(input:checked) { border-color: var(--primary); }
.check-plain { border: 0; padding: 4px 0; }
.check-plain:has(input:checked) { background: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 800; font-size: 1rem;
  padding: 12px 20px; min-height: 48px;
  border-radius: 12px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--primary); color: #fff;
  transition: transform .06s, filter .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn[disabled], .btn.cargando { opacity: .7; cursor: progress; }
.btn-block { width: 100%; min-height: 56px; font-size: 1.05rem; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: var(--line-2); filter: none; }
.btn-danger { background: var(--err); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; border-radius: 9px; }
.btn .spin { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: girar .7s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: .93rem; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert-ok { background: var(--ok-soft); color: #0E5535; }
.aviso-servidor { padding: 12px 14px; border-radius: var(--radius-sm); font-size: .93rem; margin-bottom: 16px; background: var(--err-soft); color: #8A1C12; border-left: 4px solid #C0392B; }
.alert-err { background: var(--err-soft); color: #8A1C12; }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--gold-soft); color: #5B4316; }

/* Combobox de tiendas */
.combo { position: relative; }
.combo-lista {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 280px; overflow: auto; margin: 0; padding: 6px; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.combo-lista li { padding: 11px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.combo-lista li[aria-selected="true"], .combo-lista li:hover { background: var(--line-2); }
.combo-lista li mark { background: var(--gold-soft); color: inherit; border-radius: 3px; }
.combo-lista .vacio { color: var(--muted); font-weight: 500; cursor: default; }
.combo-elegida {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 52px; padding: 10px 14px; border: 1.5px solid var(--primary); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 4%, #fff); font-weight: 700;
}

/* Carga de comprobante */
.upload {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; padding: 18px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius); background: #FCFBF8;
  transition: border-color .15s, background .15s;
}
.upload:hover, .upload.sobre { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 3%, #fff); }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-icono { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--navy); }
.upload strong { font-size: 1rem; }
.upload-preview { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1.5px solid var(--ok); border-radius: var(--radius); background: var(--ok-soft); }
.upload-preview img, .upload-preview .pdf { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; background: #fff; display: grid; place-items: center; font-weight: 800; color: var(--err); }
.upload-preview .nombre { font-weight: 700; font-size: .92rem; word-break: break-all; }

.resumen { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: .95rem; margin: 0; }
.resumen dt { color: var(--muted); }
.resumen dd { margin: 0; font-weight: 700; text-align: right; }

/* Éxito */
.exito { text-align: center; padding-top: 28px; }
.exito-icono {
  width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ok); color: #fff;
  animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both;
}
.exito-icono svg path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: trazo .45s .25s ease-out forwards; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@keyframes trazo { to { stroke-dashoffset: 0; } }
.codigo-accion {
  display: inline-block; margin: 6px 0 14px; padding: 8px 18px; border-radius: 12px;
  background: var(--gold-soft); color: var(--navy); font-size: 1.6rem; font-weight: 800; letter-spacing: .06em;
}
.contador { font-size: 1.05rem; }
.contador strong { font-size: 1.4rem; color: var(--primary); }

.lista-acciones { list-style: none; margin: 0; padding: 0; }
.lista-acciones li { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.lista-acciones li:last-child { border-bottom: 0; }

.chip { display: inline-block; font-size: .74rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-err { background: var(--err-soft); color: var(--err); }
.chip-gold { background: var(--gold-soft); color: #7A5A1C; }
.chip-navy { background: #E6EAF2; color: var(--navy); }
.chip-gris { background: var(--line-2); color: var(--muted); }

.pub-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 8px 16px 32px; }
.pub-footer a { color: var(--muted); }
.pub-footer .sep { margin: 0 8px; opacity: .5; }
.credito { margin-top: 14px; opacity: .75; }
.credito a { font-weight: 700; text-decoration: none; }
.credito a:hover { text-decoration: underline; }

.campana-card { display: block; text-decoration: none; color: inherit; }
.campana-card:hover { border-color: var(--gold); }

/* ---------- Administración ---------- */

.adm { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.adm-side { background: var(--navy); color: #C9D1E3; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.adm-side .marca { display: block; padding: 0 6px 4px; }
.adm-side .sub { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gold-2); padding: 0 10px 18px; }
.adm-side nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: #C9D1E3; text-decoration: none; font-weight: 600; font-size: .94rem;
}
.adm-side nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.adm-side nav a.activo { background: rgba(226, 200, 143, .16); color: #fff; }
.adm-side nav a svg { flex: none; opacity: .85; }
.adm-side .grupo { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: #8592AE; padding: 18px 12px 6px; }
.adm-side select { width: 100%; background: var(--navy-2); color: #fff; border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; padding: 9px 10px; font: inherit; font-size: .9rem; margin-bottom: 8px; }
.adm-usuario { margin-top: 24px; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .86rem; }
.adm-usuario button { color: var(--gold-2); }

.adm-main { padding: 24px 28px 48px; min-width: 0; }
.adm-titulo { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.adm-titulo h1 { font-size: 1.55rem; font-weight: 800; margin: 0; }
.adm-titulo .crumb { font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.adm-movil { display: none; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .etq { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi .val { font-size: 1.9rem; font-weight: 800; color: var(--navy); line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }

.barras { list-style: none; margin: 0; padding: 0; }
.barras li { display: grid; grid-template-columns: 140px 1fr 48px; gap: 10px; align-items: center; font-size: .88rem; padding: 5px 0; }
.barras .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.barras .barra { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.barras .barra span { display: block; height: 100%; background: var(--navy); border-radius: 5px; }
.barras .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.columnas { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; }
.columnas div { flex: 1; min-width: 4px; background: var(--gold); border-radius: 3px 3px 0 0; position: relative; }
.columnas div:hover { background: var(--navy); }

.tabla-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #FCFBF8; white-space: nowrap; }
.tabla td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr.clic { cursor: pointer; }
.tabla tr.clic:hover td { background: #FCFBF8; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }

.filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filtros .input { min-height: 42px; padding: 8px 12px; font-size: .92rem; width: auto; }
.filtros .buscar { flex: 1; min-width: 220px; }

.paginacion { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; font-size: .88rem; color: var(--muted); }

.ficha { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; font-size: .93rem; }
.ficha dt { color: var(--muted); }
.ficha dd { margin: 0; font-weight: 600; word-break: break-word; }

.comprobante { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: #F4F2EC; }
.comprobante img { width: 100%; max-height: 640px; object-fit: contain; }
.comprobante iframe { width: 100%; height: 640px; border: 0; }

.sorteo-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: start; }
.sorteo-num { width: 56px; height: 56px; border-radius: 14px; background: var(--navy); color: var(--gold-2); display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; }
.ganadores-mini { list-style: none; margin: 8px 0 0; padding: 0; }
.ganadores-mini li { padding: 4px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.opciones-tipo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opcion { position: relative; display: block; cursor: pointer; padding: 16px; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; }
.opcion input { position: absolute; opacity: 0; }
.opcion:has(input:checked) { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27, 42, 74, .1); }
.opcion strong { display: block; font-size: 1.05rem; }
.opcion span { font-size: .86rem; color: var(--muted); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(100% 100% at 50% 0%, #fff 0%, var(--cream) 60%); }
.login { width: 100%; max-width: 400px; }

@media (max-width: 900px) {
  .adm { grid-template-columns: 1fr; }
  .adm-side { position: fixed; inset: 0 30% 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; height: auto; }
  .adm-side.abierto { transform: none; box-shadow: var(--shadow-lg); }
  .adm-movil { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 40; }
  .adm-movil .marca img { height: 34px; }
  .adm-movil button { background: none; border: 0; color: #fff; padding: 6px; }
  .adm-main { padding: 18px 16px 40px; }
  .grid-2, .grid-2-1 { grid-template-columns: 1fr; }
  .ficha { grid-template-columns: 1fr; gap: 2px; }
  .ficha dd { margin-bottom: 8px; }
  .sorteo-item { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .card { padding: 18px; }
  .hero h1 { font-size: 1.3rem; }
  .barras li { grid-template-columns: 100px 1fr 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
