:root {
  --primario: #12b76a;
  --primario-osc: #079455;
  --primario-suave: #ecfdf3;
  --fondo: #f6f7f9;
  --tarjeta: #ffffff;
  --texto: #101828;
  --texto-2: #475467;
  --suave: #98a2b3;
  --linea: #eaecf0;
  --rojo: #d92d20; --rojo-suave: #fef3f2;
  --ambar: #dc6803; --ambar-suave: #fffaeb;
  --azul: #1570ef; --azul-suave: #eff8ff;
  --morado: #7a5af8; --morado-suave: #f4f3ff;
  --rosa: #dd2590; --rosa-suave: #fdf2fa;
  --sombra: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 16px -4px rgba(16, 24, 40, .06);
  --radio: 20px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  background: var(--fondo); color: var(--texto); font-size: 15px; line-height: 1.4;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
svg.ic { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Cabecera estilo "título grande" */
.cabecera {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 20px 6px; max-width: 720px; margin: 0 auto;
}
.cabecera .saludo { font-size: 13px; color: var(--texto-2); font-weight: 500; }
.cabecera h1 { font-size: 28px; line-height: 1.15; margin: 2px 0 0; font-weight: 750; letter-spacing: -.02em; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--primario-suave); color: var(--primario-osc); font-weight: 700; font-size: 16px;
}
main { padding: 10px 20px 20px; max-width: 720px; margin: 0 auto; }

/* Navegación inferior con botón central de escanear */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom);
}
.nav-int { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 720px; margin: 0 auto; align-items: end; }
.nav button {
  background: none; border: 0; padding: 10px 2px 10px; font: inherit; font-size: 11px; font-weight: 500;
  color: var(--suave); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
}
.nav button.activa { color: var(--primario-osc); }
.nav .central span.burbuja {
  width: 56px; height: 56px; border-radius: 50%; margin-top: -26px;
  background: var(--primario); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 20px -6px rgba(18, 183, 106, .6);
}
.nav .central span.burbuja svg.ic { width: 26px; height: 26px; }
.nav .central.activa { color: var(--primario-osc); }

/* Bloques */
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); padding: 16px; margin-bottom: 14px; box-shadow: var(--sombra); }
.seccion { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 10px; }
.seccion h2 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.seccion a, .enlace { color: var(--primario-osc); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; background: none; border: 0; padding: 0; font-family: inherit; }

.hero {
  background: var(--primario-osc); color: #fff; border-radius: 24px; padding: 20px; margin-bottom: 14px;
  box-shadow: 0 12px 28px -12px rgba(7, 148, 85, .55); position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.hero .etiqueta { font-size: 14px; opacity: .85; font-weight: 500; }
.hero .grande { font-size: 38px; font-weight: 750; letter-spacing: -.02em; margin: 4px 0 14px; }
.hero .mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hero .mini div { background: rgba(255, 255, 255, .14); border-radius: 14px; padding: 10px; }
.hero .mini b { display: block; font-size: 17px; }
.hero .mini span { font-size: 12px; opacity: .85; }

.lista .item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--linea); }
.lista .item:last-child { border-bottom: 0; padding-bottom: 2px; }
.lista .item:first-child { padding-top: 2px; }
.lista .item.toque { cursor: pointer; }
.burb { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 21px; flex: none; background: var(--fondo); }
.item .cuerpo { flex: 1; min-width: 0; }
.item .cuerpo b { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .cuerpo small { display: block; color: var(--texto-2); font-size: 13px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .der { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .der b { display: block; font-weight: 650; }
.item .der small { display: block; color: var(--texto-2); font-size: 12px; }

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

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--primario-suave); color: var(--primario-osc); white-space: nowrap; }
.chip.rojo { background: var(--rojo-suave); color: var(--rojo); }
.chip.ambar { background: var(--ambar-suave); color: var(--ambar); }
.chip.azul { background: var(--azul-suave); color: var(--azul); }
.chip.gris { background: var(--fondo); color: var(--texto-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }

/* Formularios */
label { display: block; font-size: 13px; font-weight: 600; color: var(--texto-2); margin: 14px 0 6px; }
input, select {
  width: 100%; padding: 13px 14px; font: inherit; font-size: 16px; border-radius: 14px;
  border: 1.5px solid var(--linea); background: #fff; color: var(--texto); outline: none; transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--primario); box-shadow: 0 0 0 4px var(--primario-suave); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primario); vertical-align: middle; margin: 0 8px 0 0; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.boton {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 15px; margin-top: 16px;
  font: inherit; font-size: 16px; font-weight: 650; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--primario); color: #fff; box-shadow: 0 6px 16px -8px rgba(18, 183, 106, .7);
}
.boton.secundario { background: var(--primario-suave); color: var(--primario-osc); box-shadow: none; }
.boton.fantasma { background: transparent; color: var(--texto-2); box-shadow: none; }
.boton:disabled { opacity: .45; box-shadow: none; }
.mini-boton { border: 1.5px solid var(--linea); background: #fff; color: var(--texto); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.mini-boton.verde { border-color: transparent; background: var(--primario-suave); color: var(--primario-osc); }

.subir {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 12px; border-radius: 18px;
  border: 2px dashed #c7ebd8; background: var(--primario-suave); color: var(--primario-osc); cursor: pointer; text-align: center; font-weight: 600;
}
.subir small { color: var(--texto-2); font-weight: 400; }
.subir input { display: none; }

.veredicto { border-radius: var(--radio); padding: 18px; margin-bottom: 14px; display: flex; gap: 14px; align-items: flex-start; }
.veredicto .icono-v { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; font-size: 22px; }
.veredicto.ok { background: var(--primario-suave); } .veredicto.ok .icono-v { background: var(--primario); }
.veredicto.malo { background: var(--rojo-suave); } .veredicto.malo .icono-v { background: #f04438; }
.veredicto.neutro { background: var(--azul-suave); } .veredicto.neutro .icono-v { background: var(--azul); }
.veredicto strong { font-size: 18px; display: block; margin-bottom: 4px; letter-spacing: -.01em; }
.veredicto p { margin: 0; color: var(--texto-2); }

.fotos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.foto img { width: 86px; height: 112px; object-fit: cover; border-radius: 14px; display: block; }
.foto .acciones { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }
.foto .acciones button { padding: 4px 8px; }

.linea-ticket { padding: 12px 0; border-bottom: 1px solid var(--linea); }
.linea-ticket .arriba { display: grid; grid-template-columns: 48px 1fr 84px; gap: 8px; }
.linea-ticket input { padding: 9px 10px; font-size: 15px; border-radius: 12px; }
.linea-ticket .abajo { font-size: 13px; color: var(--texto-2); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.linea-ticket details summary { color: var(--primario-osc); font-weight: 600; font-size: 13px; margin-top: 8px; cursor: pointer; }

.buscador { position: relative; margin-bottom: 14px; }
.buscador svg.ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--suave); width: 20px; height: 20px; }
.buscador input { padding-left: 44px; border-color: transparent; box-shadow: var(--sombra); }
.aviso { font-size: 14px; color: var(--texto-2); margin: 4px 0 0; }
.progreso { font-size: 14px; color: var(--texto-2); margin-top: 10px; }
.vacio { text-align: center; color: var(--texto-2); padding: 18px 8px; }
.vacio .grande-emoji { font-size: 36px; display: block; margin-bottom: 6px; }
.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.dims div { background: var(--fondo); border-radius: 14px; padding: 10px 6px; text-align: center; font-size: 12px; color: var(--texto-2); }
.dims b { display: block; font-size: 15px; color: var(--texto); margin-bottom: 2px; }
.volver { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.volver svg.ic { width: 18px; height: 18px; }

/* Pantalla de cuenta */
.acceso { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px calc(32px + env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto; }
.acceso .logo { width: 72px; height: 72px; border-radius: 22px; background: var(--primario); display: grid; place-items: center; margin-bottom: 20px; box-shadow: 0 12px 24px -10px rgba(18, 183, 106, .7); }
.acceso .logo svg { width: 40px; height: 40px; stroke: #fff; }
.acceso h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.02em; }
.acceso p.intro { color: var(--texto-2); margin: 0 0 8px; font-size: 16px; }
.acceso .error { color: var(--rojo); font-size: 14px; margin-top: 10px; min-height: 20px; }
.acceso .pie { text-align: center; margin-top: 14px; font-size: 14px; color: var(--texto-2); }
body.sin-nav { padding-bottom: 0; }
.codigo {
  margin: 18px 0 4px; padding: 18px 12px; border-radius: 18px; background: #fff; box-shadow: var(--sombra);
  border: 2px dashed #c7ebd8; text-align: center; font: 700 19px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: .06em; color: var(--texto); word-break: break-all; user-select: all;
}
.codigo-input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; text-transform: uppercase; }
.sello { margin: 16px 0 4px; padding: 14px; border-radius: 18px; background: var(--azul-suave); text-align: center; }
.sello span { display: block; font-size: 12px; font-weight: 700; color: var(--azul); text-transform: uppercase; letter-spacing: .06em; }
.sello b { display: block; font-size: 30px; letter-spacing: .2em; margin: 4px 0; }
.sello small { display: block; color: var(--texto-2); font-size: 13px; }
.alerta { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--ambar-suave); color: var(--texto); font-size: 14px; line-height: 1.45; }
.fuerza small { display: block; font-size: 12px; font-weight: 600; margin-top: 4px; }
.campo-pass { position: relative; }
.campo-pass input { padding-right: 52px; }
.ver-pass {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px;
  border: 0; background: transparent; color: var(--texto-2); border-radius: 12px; display: grid; place-items: center; cursor: pointer;
}
.ver-pass:focus-visible { outline: 3px solid var(--primario-suave); }
.ver-pass[aria-pressed="true"] { color: var(--primario-osc); }
.coincide { min-height: 26px; margin-top: 6px; }
.check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #d0d5dd; background: #fff; color: #fff; font-weight: 800; flex: none; cursor: pointer; display: grid; place-items: center; font-size: 15px; }
.check.marcado { background: var(--primario); border-color: var(--primario); }
.buscador form, form.buscador { margin-bottom: 14px; }

/* Selector de archivos fuera de la vista (dentro de la página para que el sistema avise al elegir) */
.selector-oculto { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

/* Estado de cada archivo */
.archivos { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.archivo { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 16px; background: var(--fondo); }
.archivo .mini { width: 56px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; background: #e4e7ec; display: grid; place-items: center; font-size: 22px; overflow: hidden; }
.archivo .mini img { width: 100%; height: 100%; object-fit: cover; }
.archivo .info { flex: 1; min-width: 0; }
.archivo .info b { display: block; font-size: 14px; }
.archivo .info small { display: block; color: var(--texto-2); font-size: 12px; margin-top: 2px; }
.archivo .estado { margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.archivo .barra-h { flex: 1; min-width: 80px; margin-top: 0; }
.archivo .barra-h i { background: var(--primario); transition: width .2s; }
.archivo .acciones { display: flex; flex-direction: column; gap: 4px; }
.archivo.error { background: var(--rojo-suave); }
.resumen-archivos { font-size: 13px; color: var(--texto-2); margin-top: 12px; }

/* Avatar con foto */
.avatar { overflow: hidden; padding: 0; display: grid; place-items: center; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tarjeta.perfil { display: flex; align-items: center; gap: 16px; }
.tarjeta.perfil b { display: block; font-size: 18px; }
.tarjeta.perfil small { display: block; color: var(--texto-2); margin: 2px 0 6px; word-break: break-all; }
.avatar.grande { width: 88px; height: 88px; font-size: 34px; position: relative; overflow: visible; flex: none; }
.avatar.grande img { border-radius: 50%; }
.avatar .lapiz { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--primario); color: #fff;
  display: grid; place-items: center; font-size: 15px; border: 3px solid #fff; }

/* Diálogos */
.dialogo-fondo, .editor-foto { position: fixed; inset: 0; z-index: 50; background: rgba(16, 24, 40, .45); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.dialogo { background: #fff; border-radius: 26px; padding: 24px 20px calc(18px + env(safe-area-inset-bottom)); width: 100%; max-width: 440px; max-height: 92vh; overflow: auto;
  box-shadow: 0 20px 50px -12px rgba(16, 24, 40, .35); animation: subir .22s ease-out; }
@keyframes subir { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialogo h2 { margin: 6px 0 8px; font-size: 21px; letter-spacing: -.01em; }
.dialogo-icono { font-size: 40px; }
.dialogo-texto { color: var(--texto-2); font-size: 15px; }
.dialogo-texto p { margin: 0 0 10px; }
.dialogo-texto ol { padding-left: 20px; margin: 8px 0 10px; }
.dialogo-texto li { margin-bottom: 6px; }
.boton svg.ic { width: 20px; height: 20px; }

/* Cámara */
.camara { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; }
.camara video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camara video.espejo { transform: scaleX(-1); }
.camara.destello::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: .7; }
.camara-arriba, .camara-abajo { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.camara-arriba { top: 0; padding-top: calc(14px + env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.55), transparent); font-weight: 600; font-size: 14px; }
.camara-abajo { bottom: 0; padding-bottom: calc(26px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.camara-btn { min-width: 48px; height: 48px; border-radius: 24px; border: 0; background: rgba(255,255,255,.18); color: #fff; font: inherit; font-weight: 700; font-size: 17px; padding: 0 14px; cursor: pointer; }
.camara-btn[aria-pressed="true"] { background: #fff; color: #000; }
.camara-btn.listo { background: var(--primario); }
.camara-btn:disabled { opacity: .4; }
.camara-cuenta { min-width: 72px; font-size: 14px; font-weight: 600; }
.disparador { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.9); box-shadow: 0 0 0 3px rgba(0,0,0,.25); cursor: pointer; }
.disparador:active { transform: scale(.92); }
.guia-circulo { position: absolute; left: 50%; top: 45%; width: 70vw; max-width: 320px; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45); border: 3px solid rgba(255,255,255,.85); pointer-events: none; }

/* Editor de foto de perfil */
.editor-foto .dialogo { text-align: left; }
.lienzo-circulo { width: 280px; height: 280px; margin: 10px auto 4px; border-radius: 50%; overflow: hidden; touch-action: none; box-shadow: var(--sombra); background: var(--fondo); }
.lienzo-circulo canvas { display: block; cursor: grab; touch-action: none; }
input[type=range] { padding: 0; border: 0; box-shadow: none; accent-color: var(--primario); }
