:root {
  --verde: #1F4136;
  --verde-2: #2C5A4B;
  --verde-claro: #E7EEEA;
  --ocre: #E8B04A;
  --ocre-claro: #FBF1DC;
  --fondo: #F5F4EF;
  --blanco: #FFFFFF;
  --texto: #1B1F1D;
  --gris: #6B716E;
  --linea: #E2E0D8;
  --rojo: #B3261E;
  --wa: #1FA855;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --nav-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--fondo); color: var(--texto);
  font-size: 16px; line-height: 1.4;
  min-height: 100vh; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--verde); }

/* ---------- Estructura ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--verde); color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 12px;
  display: flex; align-items: center; gap: 10px; min-height: 56px;
}
.top h1 { font-size: 19px; font-weight: 700; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .atras, .top .accion {
  background: none; border: 0; color: #fff; padding: 6px; margin: -6px; cursor: pointer;
  display: grid; place-items: center; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 15px;
}
.top .accion { color: var(--ocre); }
.top svg { width: 24px; height: 24px; }
.top .logo { width: 22px; height: 22px; }
.banner-prueba {
  background: var(--ocre); color: var(--verde); font-size: 13px; font-weight: 600;
  padding: 6px 16px; text-align: center;
}
main {
  max-width: 720px; margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 90px + env(safe-area-inset-bottom));
}
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--blanco); border-top: 1px solid var(--linea);
  display: flex; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 8px; font-size: 12px; color: var(--gris); text-decoration: none; font-weight: 600;
}
.nav a svg { width: 24px; height: 24px; }
.nav a.activo { color: var(--verde); }
.nav a.activo svg { stroke: var(--verde); }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 15;
  background: var(--ocre); color: var(--verde); border: 0; border-radius: 999px;
  padding: 15px 22px 15px 18px; font-weight: 700; font-size: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18); display: flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.fab svg { width: 22px; height: 22px; }

/* ---------- Bloques ---------- */
.card {
  background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 14px 16px; margin-bottom: 10px; display: block; color: inherit; text-decoration: none;
}
a.card:active, .item:active { background: #FAFAF7; }
.titulo-seccion {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--gris);
  font-weight: 700; margin: 22px 4px 8px;
}
.titulo-seccion:first-child { margin-top: 4px; }
.lista { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; margin-bottom: 10px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid var(--linea); color: inherit; text-decoration: none;
}
.item:last-child { border-bottom: 0; }
.item .cuerpo { flex: 1; min-width: 0; }
.item .principal { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .secundario { font-size: 14px; color: var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .monto { font-weight: 700; white-space: nowrap; text-align: right; }
.item .monto small { display: block; font-weight: 500; color: var(--gris); font-size: 12px; }
.vacio { text-align: center; color: var(--gris); padding: 30px 16px; }
.vacio b { color: var(--texto); display: block; font-size: 17px; margin-bottom: 4px; }

.totales { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.total {
  background: var(--verde); color: #fff; border-radius: var(--radio); padding: 12px 14px;
}
.total.usd { background: var(--verde-2); }
.total span { font-size: 12px; opacity: .8; display: block; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.total b { font-size: 21px; display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chip {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--verde-claro); color: var(--verde); margin: 2px 4px 2px 0; white-space: nowrap;
}
.chip.ocre { background: var(--ocre-claro); color: #7A5714; }
.chip.rojo { background: #FBE9E7; color: var(--rojo); }
.chip.gris { background: #EEEDE8; color: var(--gris); }
.estrellas { color: var(--ocre); letter-spacing: 1px; font-size: 15px; white-space: nowrap; }
.estrellas .off { color: #D9D6CC; }

.barra { height: 8px; background: var(--verde-claro); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.barra i { display: block; height: 100%; background: var(--verde); border-radius: 99px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 700; font-size: 16px; cursor: pointer;
  background: var(--verde); color: #fff; text-decoration: none; min-height: 48px;
}
.btn svg { width: 20px; height: 20px; }
.btn.ocre { background: var(--ocre); color: var(--verde); }
.btn.claro { background: var(--verde-claro); color: var(--verde); }
.btn.blanco { background: var(--blanco); color: var(--verde); border: 1.5px solid var(--linea); }
.btn.wa { background: var(--wa); color: #fff; }
.btn.peligro { background: #FBE9E7; color: var(--rojo); }
.btn.chico { padding: 8px 12px; min-height: 38px; font-size: 14px; border-radius: 10px; }
.btn.ancho { width: 100%; }
.btn:disabled { opacity: .55; }
.botones { display: flex; gap: 8px; flex-wrap: wrap; }
.botones .btn { flex: 1; }
.icono-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 0; display: grid; place-items: center; flex-shrink: 0;
  text-decoration: none; cursor: pointer;
}
.icono-btn svg { width: 22px; height: 22px; }
.icono-btn.wa { background: #E3F5EA; color: var(--wa); }
.icono-btn.tel { background: var(--verde-claro); color: var(--verde); }

.grande {
  display: flex; align-items: center; gap: 16px; padding: 22px 20px; margin-bottom: 12px;
  background: var(--verde); color: #fff; border-radius: 18px; text-decoration: none; font-weight: 700; font-size: 20px;
  box-shadow: var(--sombra);
}
.grande.ocre { background: var(--ocre); color: var(--verde); }
.grande svg { width: 34px; height: 34px; flex-shrink: 0; }
.grande small { display: block; font-weight: 500; font-size: 14px; opacity: .85; }

/* ---------- Formularios ---------- */
.campo { margin-bottom: 14px; }
.campo > label, .campo > .etiqueta { display: block; font-weight: 600; font-size: 14px; margin: 0 2px 6px; color: var(--verde); }
.campo .ayuda { font-size: 13px; color: var(--gris); margin: 5px 2px 0; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date], input[type=month], input[type=search], select, textarea {
  width: 100%; border: 1.5px solid var(--linea); background: var(--blanco); border-radius: 12px;
  padding: 12px 14px; font-size: 16px; min-height: 48px; outline: none; appearance: none; -webkit-appearance: none;
}
select {
  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='%231F4136' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--verde); }
.monto-grande { display: flex; gap: 8px; }
.monto-grande input { font-size: 26px; font-weight: 700; padding: 10px 14px; }
.segmento { display: flex; background: var(--verde-claro); border-radius: 12px; padding: 3px; flex-shrink: 0; }
.segmento button {
  border: 0; background: none; padding: 0 14px; border-radius: 10px; font-weight: 700; color: var(--verde); cursor: pointer; min-height: 44px;
}
.segmento button.on { background: var(--verde); color: #fff; }
.chips-elegir { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-elegir button {
  border: 1.5px solid var(--linea); background: var(--blanco); border-radius: 999px; padding: 7px 13px;
  font-size: 14px; font-weight: 600; cursor: pointer; color: var(--texto);
}
.chips-elegir button.on { background: var(--verde); border-color: var(--verde); color: #fff; }
.elegir-estrellas { display: flex; gap: 4px; }
.elegir-estrellas button { border: 0; background: none; font-size: 34px; line-height: 1; color: #D9D6CC; cursor: pointer; padding: 2px; }
.elegir-estrellas button.on { color: var(--ocre); }

.foto-caja { display: flex; gap: 8px; }
.foto-caja label { flex: 1; }
.foto-caja input[type=file] { display: none; }
.foto-previa { margin-top: 10px; position: relative; }
.foto-previa img { width: 100%; max-height: 340px; object-fit: contain; border-radius: 12px; background: #000; display: block; }
.foto-previa button { position: absolute; top: 8px; right: 8px; }
.foto-mini { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--verde-claro); flex-shrink: 0; }
.galeria { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.galeria a { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--verde-claro); display: block; }
.galeria img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galeria span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; color: #fff; padding: 12px 6px 4px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }

.filtros { display: flex; gap: 8px; margin-bottom: 10px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtros select, .filtros input { min-height: 42px; padding: 8px 32px 8px 12px; font-size: 14px; border-radius: 10px; width: auto; flex-shrink: 0; }
.filtros input[type=month] { padding-right: 12px; }
.buscador { position: relative; margin-bottom: 10px; }
.buscador input { padding-left: 42px; }
.buscador svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--gris); }

.dato { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--linea); }
.dato:last-child { border-bottom: 0; }
.dato span { color: var(--gris); font-size: 14px; flex-shrink: 0; }
.dato b { font-weight: 600; text-align: right; word-break: break-word; }

.cabecera-ficha { text-align: center; padding: 8px 0 16px; }
.cabecera-ficha h2 { margin: 0; font-size: 24px; }
.cabecera-ficha .apodo { color: var(--gris); margin-top: 2px; }
.cabecera-ficha .estrellas { font-size: 22px; display: block; margin-top: 6px; }

/* ---------- Login ---------- */
.login { max-width: 400px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 40px) 22px 40px; }
.login .marca { text-align: center; margin-bottom: 28px; }
.login .marca svg { width: 64px; height: 64px; }
.login .marca h1 { color: var(--verde); margin: 10px 0 2px; font-size: 26px; }
.login .marca p { color: var(--gris); margin: 0; }
.login .cambiar { text-align: center; margin-top: 18px; }
.login .cambiar button { background: none; border: 0; color: var(--verde); font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- Avisos ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--texto); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 100;
  font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100% - 32px); text-align: center;
  animation: aparecer .2s ease-out;
}
.toast.error { background: var(--rojo); }
@keyframes aparecer { from { opacity: 0; transform: translate(-50%, 10px); } }
.aviso { background: var(--ocre-claro); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; color: #5E4310; }
.aviso.verde { background: var(--verde-claro); color: var(--verde); }
.cargando { text-align: center; padding: 60px 0; color: var(--gris); }
.visor { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 200; display: grid; place-items: center; padding: 16px; }
.visor img { max-width: 100%; max-height: 100%; object-fit: contain; }
.visor button { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 12px; }
.oculto { display: none !important; }
.sep { height: 14px; }
.texto-gris { color: var(--gris); font-size: 14px; }

@media (min-width: 760px) {
  .nav { top: 0; bottom: auto; left: auto; right: 0; width: auto; border: 0; background: none; padding-top: calc(env(safe-area-inset-top) + 6px); gap: 4px; z-index: 30; }
  .nav a { flex-direction: row; color: rgba(255,255,255,.75); font-size: 14px; padding: 10px 12px; }
  .nav a.activo { color: #fff; }
  .nav a.activo svg { stroke: #fff; }
  .nav a svg { width: 20px; height: 20px; }
  .top { padding-right: 460px; }
  .fab { bottom: 24px; }
  main { padding-bottom: 110px; }
}
