/* Golden House · sistema visual
   Manual de marca Golden Paws: negro (#3F4037 -> #040404) y degradado dorado
   (#AB752D -> #FCEE82). La app es oscura a proposito: el dorado solo brilla
   sobre negro, y la tarjeta se lee bien en un mostrador con mala luz. */

:root {
  --negro: #040404;
  --negro-2: #0e0e0c;
  --negro-3: #171714;
  --negro-4: #22221e;
  --grafito: #3F4037;
  --oro-osc: #AB752D;
  --oro: #E5B94E;
  --oro-claro: #FFE865;
  --oro-palido: #FCEE82;
  --grad-oro: linear-gradient(135deg, #AB752D 0%, #D9A441 38%, #FFE865 72%, #FCEE82 100%);
  --grad-negro: linear-gradient(180deg, #3F4037 0%, #040404 100%);
  --texto: #F4F0E4;
  --texto-2: #B8B3A3;
  --texto-3: #7E7A6E;
  --linea: rgba(252, 238, 130, 0.13);
  --linea-2: rgba(252, 238, 130, 0.28);
  --ok: #7BC47F;
  --aviso: #F0B455;
  --mal: #E0735F;
  --radio: 18px;
  --radio-sm: 12px;
  --sombra: 0 10px 30px rgba(0, 0, 0, 0.45);
  --f-titulo: 'Baloo 2', 'Poppins', system-ui, sans-serif;
  --f-texto: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tabbar-h: 68px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--negro);
  background-image: radial-gradient(120% 60% at 50% -10%, rgba(171, 117, 45, 0.22), transparent 60%);
  background-attachment: fixed;
  color: var(--texto);
  font-family: var(--f-texto);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--oro-claro); }
[hidden] { display: none !important; }

/* ---------- estructura ---------- */
.app { max-width: 540px; margin: 0 auto; min-height: 100vh; position: relative; }
.screen {
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
}
.screen.sin-tabbar { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }

.top { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; min-height: 44px; }
.top .logo { height: 34px; width: auto; }
.top h1 { margin: 0; }
.top .grow { flex: 1; }

h1, h2, h3 { font-family: var(--f-titulo); font-weight: 800; letter-spacing: 0.2px; margin: 0 0 8px; line-height: 1.12; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
.eyebrow { font-size: 11.5px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--oro); font-weight: 600; margin-bottom: 6px; }
.oro { background: var(--grad-oro); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--texto-2); }
.tenue { color: var(--texto-3); font-size: 13px; }
.small { font-size: 13px; }
p { margin: 0 0 10px; }

.row { display: flex; align-items: center; gap: 10px; }
.row.top-align { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.center { text-align: center; }
.mt { margin-top: 14px; } .mt2 { margin-top: 24px; } .mb { margin-bottom: 14px; }
.sec { margin-top: 26px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.sec-head h2 { margin: 0; }
.sec-head button { background: none; border: 0; color: var(--oro); font-size: 13.5px; cursor: pointer; padding: 4px 0; }

/* ---------- superficies ---------- */
.card {
  background: var(--negro-3);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card.tap { cursor: pointer; transition: border-color .15s, transform .15s; }
.card.tap:active { transform: scale(0.99); border-color: var(--linea-2); }
.card.oro-borde { border-color: var(--linea-2); background: linear-gradient(180deg, rgba(171,117,45,.12), rgba(23,23,20,1) 55%); }

.lista { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; gap: 12px; align-items: center;
  background: var(--negro-3); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 12px; cursor: pointer; text-align: left; width: 100%;
}
.item:active { border-color: var(--linea-2); }
.item .ico {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px; background: var(--negro-4);
  overflow: hidden;
}
.item .ico img { width: 100%; height: 100%; object-fit: cover; }
.item .t { font-weight: 600; }
.item .s { color: var(--texto-2); font-size: 13px; }
.item .chev { color: var(--texto-3); font-size: 20px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--grad-oro); color: #140f06; font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 18px rgba(171, 117, 45, 0.28);
  transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(0.98); filter: brightness(0.95); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }
.btn.sec2 { background: transparent; color: var(--texto); border: 1px solid var(--linea-2); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--oro); box-shadow: none; padding: 0 10px; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn.peligro { background: transparent; color: var(--mal); border: 1px solid rgba(224,115,95,.4); box-shadow: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--linea);
  background: var(--negro-3); display: grid; place-items: center; cursor: pointer; font-size: 18px;
}

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--texto-2); font-weight: 500; }
.field .ayuda { font-size: 12px; color: var(--texto-3); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--radio-sm);
  background: var(--negro-2); border: 1px solid var(--linea); color: var(--texto);
  outline: none; font-size: 16px; /* 16px evita el zoom de iOS */
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--oro); box-shadow: 0 0 0 3px rgba(229,185,78,.18); }
input::placeholder, textarea::placeholder { color: var(--texto-3); }
.codigo-input { text-transform: uppercase; letter-spacing: 3px; font-weight: 700; text-align: center; font-size: 20px !important; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--texto-2); margin-bottom: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--oro); flex: 0 0 20px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.error { color: var(--mal); font-size: 13.5px; margin: 6px 0 10px; }

/* ---------- chips y etiquetas ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: var(--negro-3); border: 1px solid var(--linea); color: var(--texto-2); font-size: 13.5px;
}
.chip.on { background: var(--grad-oro); color: #140f06; border-color: transparent; font-weight: 600; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--negro-4); color: var(--texto-2); border: 1px solid var(--linea);
}
.tag.oro { background: rgba(229,185,78,.14); color: var(--oro-claro); border-color: var(--linea-2); -webkit-text-fill-color: currentColor; }
.tag.ok { color: var(--ok); border-color: rgba(123,196,127,.35); background: rgba(123,196,127,.08); }
.tag.aviso { color: var(--aviso); border-color: rgba(240,180,85,.35); background: rgba(240,180,85,.08); }
.tag.mal { color: var(--mal); border-color: rgba(224,115,95,.35); background: rgba(224,115,95,.08); }
.segmento { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--negro-2); border: 1px solid var(--linea); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.segmento button { border: 0; background: transparent; min-height: 38px; border-radius: 999px; color: var(--texto-2); cursor: pointer; font-weight: 500; }
.segmento button.on { background: var(--negro-4); color: var(--oro-claro); font-weight: 600; }

/* ---------- barra inferior ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 40;
  width: 100%; max-width: 540px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(8, 8, 7, 0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--linea);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 0; background: none; color: var(--texto-3); font-size: 11px; cursor: pointer; padding: 6px 0;
}
.tab .tab-ico { font-size: 21px; line-height: 1; filter: grayscale(1) brightness(1.3); opacity: .75; }
.tab.on { color: var(--oro-claro); }
.tab.on .tab-ico { filter: none; opacity: 1; }
.tab.centro .tab-ico {
  width: 54px; height: 54px; margin-top: -26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 25px;
  background: var(--grad-oro); filter: none; opacity: 1;
  box-shadow: 0 6px 20px rgba(171,117,45,.45), 0 0 0 5px var(--negro);
}
.tab.centro { color: var(--oro); }

.gear { position: absolute; top: calc(env(safe-area-inset-top) + 14px); right: 18px; z-index: 5; }
.franja:not([hidden]) ~ .gear { top: calc(env(safe-area-inset-top) + 56px); }

/* ---------- Tarjeta Golden ---------- */
.gcard {
  position: relative; overflow: hidden; border-radius: 22px;
  aspect-ratio: 1.586; /* proporcion de tarjeta bancaria CR80 */
  background: var(--grad-oro); color: #120d05;
  box-shadow: 0 18px 40px rgba(0,0,0,.55), 0 0 0 1px rgba(252,238,130,.4) inset;
  padding: 18px 20px; display: flex; flex-direction: column; justify-content: space-between;
}
.gcard::before { /* huellas en marca de agua, 25% como permite el manual */
  content: ''; position: absolute; inset: 0; opacity: .12; pointer-events: none;
  background-image: radial-gradient(circle at 20% 30%, #040404 0 3px, transparent 4px),
                    radial-gradient(circle at 80% 70%, #040404 0 3px, transparent 4px);
  background-size: 46px 46px;
}
.gcard::after { /* brillo que recorre la tarjeta: una captura de pantalla se nota quieta */
  content: ''; position: absolute; top: -60%; left: -80%; width: 45%; height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  transform: rotate(18deg); animation: brillo 3.6s ease-in-out infinite; pointer-events: none;
}
@keyframes brillo { 0% { left: -80%; } 55%, 100% { left: 140%; } }
.gcard .gc-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.gcard .gc-logo { height: 38px; width: auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.gcard .gc-house { font-family: var(--f-titulo); font-weight: 800; font-size: 13px; letter-spacing: 2.5px; text-transform: uppercase; text-align: right; }
.gcard .gc-anillo { font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 600; opacity: .8; text-align: right; }
.gcard .gc-mid { display: flex; gap: 12px; align-items: flex-end; position: relative; z-index: 1; }
.gcard .gc-foto { width: 58px; height: 58px; border-radius: 50%; border: 2.5px solid #120d05; object-fit: cover; background: rgba(0,0,0,.15); display: grid; place-items: center; font-size: 26px; overflow: hidden; flex: 0 0 58px; }
.gcard .gc-foto img { width: 100%; height: 100%; object-fit: cover; }
.gcard .gc-nombre { font-family: var(--f-titulo); font-weight: 800; font-size: 22px; line-height: 1.05; }
.gcard .gc-num { font-size: 12.5px; letter-spacing: 2px; font-weight: 600; opacity: .85; }
.gcard .gc-fundador {
  display: inline-block; margin-top: 4px; padding: 2px 9px; border-radius: 999px;
  background: #120d05; color: var(--oro-claro); font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
}

.pase {
  margin-top: 16px; background: #fff; color: #111; border-radius: var(--radio);
  padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.pase canvas, .pase svg, .pase img { width: 200px; height: 200px; image-rendering: pixelated; }
.pase .reloj { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 20px; letter-spacing: 1px; }
.pase .barra { width: 200px; height: 5px; border-radius: 3px; background: #eee; overflow: hidden; }
.pase .barra i { display: block; height: 100%; background: linear-gradient(90deg, #AB752D, #E5B94E); transition: width 1s linear; }
.pase .codigo { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; letter-spacing: 3px; color: #555; }
.pase.offline { opacity: .55; }

/* ---------- carnet del perro ---------- */
.carnet {
  border-radius: 20px; overflow: hidden; border: 1px solid var(--linea-2); background: var(--negro-2);
  box-shadow: var(--sombra);
}
.carnet .cn-head { background: var(--grad-oro); color: #120d05; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.carnet .cn-head b { font-family: var(--f-titulo); font-size: 15px; letter-spacing: 1.5px; text-transform: uppercase; }
.carnet .cn-body { display: flex; gap: 14px; padding: 16px; }
.carnet .cn-foto { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; background: var(--negro-4); display: grid; place-items: center; font-size: 40px; flex: 0 0 96px; overflow: hidden; }
.carnet .cn-foto img { width: 100%; height: 100%; object-fit: cover; }
.carnet dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 13px; }
.carnet dt { color: var(--texto-3); }
.carnet dd { margin: 0; font-weight: 500; }

/* ---------- mapa ---------- */
.mapa { height: 58vh; min-height: 340px; border-radius: var(--radio); overflow: hidden; border: 1px solid var(--linea); background: var(--negro-2); }
.leaflet-container { background: #1a1a17 !important; font-family: var(--f-texto) !important; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; border: 2px solid #040404; box-shadow: 0 3px 8px rgba(0,0,0,.5); }
.pin span { transform: rotate(45deg); font-size: 14px; }
.pin.beneficio { background: var(--grad-oro); }
.pin.compromiso { background: #fff; }
.pin.lugar { background: #8a8778; }
.leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--texto-2); margin: 8px 2px 0; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* ---------- hoja inferior (modal) ---------- */
.velo { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; animation: aparece .15s ease-out; }
.hoja {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 61;
  width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto;
  background: var(--negro-2); border: 1px solid var(--linea); border-bottom: 0;
  border-radius: 24px 24px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 22px);
  animation: sube .22s ease-out;
}
.hoja .asa { width: 42px; height: 5px; border-radius: 3px; background: var(--negro-4); margin: 0 auto 14px; }
.hoja .cerrar { position: sticky; top: 0; float: right; }
@keyframes sube { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }

/* ---------- avisos y estados ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 200; /* por encima de la hoja: ver bug del toast tras el modal */
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
  background: var(--texto); color: #111; padding: 11px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; box-shadow: var(--sombra); max-width: calc(100% - 36px); text-align: center;
}
.vacio { text-align: center; padding: 34px 18px; color: var(--texto-2); border: 1px dashed var(--linea-2); border-radius: var(--radio); }
.vacio .grande { font-size: 40px; margin-bottom: 8px; }
/* Franja de entorno: fuera de produccion siempre dice donde estas. */
.franja {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  font-size: 11.5px; text-align: center; color: #120d05; background: var(--oro-palido);
  padding: 5px 10px; font-weight: 600; letter-spacing: .4px;
}
.franja button {
  border: 1px solid rgba(18,13,5,.35); background: rgba(255,255,255,.35); color: #120d05;
  border-radius: 999px; padding: 2px 10px; font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.franja.real { background: var(--mal); color: #fff; }
.franja.real button { color: #fff; border-color: rgba(255,255,255,.6); background: rgba(0,0,0,.15); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--negro-3); border: 1px solid var(--linea); border-radius: var(--radio); padding: 14px; }
.kpi b { display: block; font-family: var(--f-titulo); font-size: 28px; line-height: 1; margin-bottom: 4px; }
.kpi span { font-size: 12.5px; color: var(--texto-2); }
.progreso { height: 8px; border-radius: 4px; background: var(--negro-4); overflow: hidden; }
.progreso i { display: block; height: 100%; background: var(--grad-oro); }
.fecha-bloque { width: 52px; flex: 0 0 52px; text-align: center; border-radius: 14px; background: var(--negro-4); padding: 6px 0; border: 1px solid var(--linea); }
.fecha-bloque b { display: block; font-family: var(--f-titulo); font-size: 22px; line-height: 1; color: var(--oro-claro); }
.fecha-bloque span { font-size: 11px; text-transform: uppercase; color: var(--texto-2); letter-spacing: 1px; }

/* ---------- entrada ---------- */
.entrada { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 30px 22px calc(env(safe-area-inset-bottom) + 30px); }
.entrada .logo-grande { width: 220px; margin: 0 auto 18px; }
.entrada .lema { text-align: center; color: var(--texto-2); margin-bottom: 28px; }
.pasos { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.pasos i { width: 26px; height: 5px; border-radius: 3px; background: var(--negro-4); }
.pasos i.on { background: var(--grad-oro); }

@media (prefers-reduced-motion: reduce) {
  .gcard::after { animation-duration: 9s; }
  .hoja, .velo { animation: none; }
}
