:root {
  --tinta: #14284B;
  --tinta-suave: #3A4D6E;
  --naranja: #F07C1E;
  --naranja-hondo: #C95E0B;
  --fondo: #F2F4F7;
  --papel: #FFFFFF;
  --linea: #D8DEE8;
  --texto: #1B2433;
  --texto-suave: #5A6577;
  --verde: #1E8A5A;
  --verde-fondo: #E4F3EB;
  --rojo: #C23B2A;
  --rojo-fondo: #FBE9E6;
  --placa-azul: #1B3F94;

  --display: "Familjen Grotesk", "Segoe UI", system-ui, sans-serif;
  --texto-familia: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --radio-chico: 6px;
  --radio: 12px;
  --radio-grande: 20px;
  --medida: 44rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 400 1.0625rem/1.55 var(--texto-familia);
  min-height: 100dvh;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); color: var(--tinta); line-height: 1.15; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--naranja); outline-offset: 2px; border-radius: 4px; }

/* ---------- Barra superior ---------- */
.barra {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem max(1rem, calc((100vw - var(--medida)) / 2));
  background: var(--tinta); color: #fff;
}
.barra__marca { display: flex; align-items: center; gap: .6rem; }
.marca__sello { width: 1.75rem; height: 1.75rem; color: var(--naranja); display: inline-flex; }
.marca__nombre { font-family: var(--display); font-weight: 600; font-size: 1.05rem; letter-spacing: .01em; }
.barra .boton-texto { color: #fff; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .7rem 1.25rem;
  border: 0; border-radius: var(--radio); cursor: pointer;
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  transition: background-color .15s, transform .05s;
}
.boton:active { transform: translateY(1px); }
.boton[disabled] { opacity: .6; cursor: progress; }
.boton--principal { background: var(--tinta); color: #fff; }
.boton--principal:hover { background: #0E1E3A; }
.boton--alerta { background: var(--naranja); color: #1B1205; }
.boton--alerta:hover { background: #E06D10; }
.boton--secundario { background: var(--papel); color: var(--tinta); border: 1.5px solid var(--linea); }
.boton--secundario:hover { border-color: var(--tinta-suave); }
.boton-texto {
  background: none; border: 0; padding: .4rem .2rem; cursor: pointer;
  color: var(--tinta); text-decoration: underline; text-underline-offset: 3px; font-size: .98rem;
}

/* ---------- Formularios ---------- */
.formulario { display: grid; gap: 1rem; }
.campo { display: grid; gap: .35rem; }
.campo__etiqueta { font-weight: 700; font-size: .95rem; color: var(--tinta); }
.campo__etiqueta small { font-weight: 400; color: var(--texto-suave); }
.campo input, .campo select, .campo textarea, .filtros select {
  width: 100%; min-height: 3rem; padding: .65rem .85rem;
  background: var(--papel); border: 1.5px solid var(--linea); border-radius: var(--radio-chico);
}
.campo textarea { resize: vertical; min-height: 6rem; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--tinta); outline: none; box-shadow: 0 0 0 3px rgba(240,124,30,.35); }
.campo__codigo { font-family: var(--display); font-size: 1.75rem !important; letter-spacing: .5em; text-align: center; }
.campos-dobles { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .campos-dobles { grid-template-columns: 1fr 1fr; } }
fieldset { border: 0; margin: 0; padding: 0; }
legend { padding: 0; margin-bottom: .4rem; }
.opciones { display: grid; gap: .5rem; }
.opciones label {
  display: flex; gap: .75rem; align-items: flex-start; cursor: pointer;
  padding: .75rem .9rem; border: 1.5px solid var(--linea); border-radius: var(--radio-chico); background: var(--papel);
}
.opciones label:has(input:checked) { border-color: var(--tinta); background: #F4F6FB; }
.opciones input { margin-top: .3rem; accent-color: var(--tinta); }
.opciones span { display: grid; font-size: .95rem; color: var(--texto-suave); }
.opciones b { color: var(--texto); font-size: 1rem; }
.si-no { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: center; }
.si-no legend { width: 100%; }
.si-no label { display: inline-flex; gap: .4rem; align-items: center; min-height: 2.5rem; }
.si-no input { accent-color: var(--tinta); width: 1.15rem; height: 1.15rem; }
.error { margin: 0; padding: .7rem .9rem; border-radius: var(--radio-chico); background: var(--rojo-fondo); color: #8E2A1D; font-size: .95rem; }
.nota { margin: 0; font-size: .95rem; color: var(--texto-suave); }
.nota--urgente { padding: .75rem .9rem; border-left: 4px solid var(--naranja); background: #FFF4EA; color: #5B3410; border-radius: 0 var(--radio-chico) var(--radio-chico) 0; }
.aviso-suave { margin: 0; color: var(--texto-suave); }

/* ---------- Acceso ---------- */
.acceso { min-height: calc(100dvh - 3.5rem); display: grid; place-items: start center; padding: 2rem 1rem 3rem; }
@media (min-height: 700px) { .acceso { place-items: center; } }
.acceso__panel { width: 100%; max-width: 26rem; display: grid; gap: 1.25rem; }
.acceso__titulo { font-size: clamp(2.2rem, 7vw, 3rem); font-weight: 700; letter-spacing: -.02em; }
.acceso__bajada { margin: 0; color: var(--texto-suave); font-size: 1.1rem; max-width: 30ch; }
.acceso__ayuda { margin: 0; font-size: .95rem; color: var(--texto-suave); }
.acceso__ayuda a { color: var(--tinta); }

/* ---------- Pólizas ---------- */
.polizas { max-width: var(--medida); margin: 0 auto; padding: 1.5rem 1rem 4rem; display: grid; gap: 1.5rem; }
.saludo { display: grid; gap: .5rem; justify-items: start; }
.saludo__titulo { font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 700; letter-spacing: -.015em; }
.saludo__resumen { margin: 0 0 .5rem; color: var(--texto-suave); font-size: 1.1rem; }
.saludo__resumen strong { color: var(--rojo); }

.filtros { display: grid; gap: .75rem; }
.buscador {
  display: flex; align-items: center; gap: .6rem; padding: 0 .9rem; min-height: 3.25rem;
  background: var(--papel); border: 1.5px solid var(--linea); border-radius: var(--radio);
}
.buscador:focus-within { border-color: var(--tinta); box-shadow: 0 0 0 3px rgba(240,124,30,.35); }
.buscador svg { width: 1.2rem; height: 1.2rem; color: var(--texto-suave); flex: none; }
.buscador input { border: 0; outline: 0; background: none; width: 100%; min-height: 3rem; }
.filtros__fila { display: flex; flex-wrap: wrap; gap: .5rem; }
.filtros select { width: auto; min-height: 2.6rem; padding: .4rem .7rem; flex: 1 1 10rem; font-size: .95rem; }
.segmentado { display: inline-flex; padding: 3px; background: #E3E7EE; border-radius: var(--radio); }
.segmentado button { border: 0; background: none; padding: .45rem 1rem; border-radius: 9px; cursor: pointer; font-weight: 700; color: var(--texto-suave); min-height: 2.3rem; }
.segmentado button[aria-checked="true"] { background: var(--papel); color: var(--tinta); box-shadow: 0 1px 2px rgba(20,40,75,.15); }

.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.poliza {
  display: grid; gap: .8rem; width: 100%; text-align: left; cursor: pointer;
  padding: 1rem 1.1rem 1.1rem; background: var(--papel);
  border: 1px solid var(--linea); border-left: 5px solid var(--linea); border-radius: var(--radio-chico) var(--radio) var(--radio) var(--radio-chico);
}
.poliza:hover { border-top-color: #AEB8CA; border-right-color: #AEB8CA; border-bottom-color: #AEB8CA; }
.poliza--vigente { border-left-color: var(--verde); }
.poliza--deuda { border-left-color: var(--rojo); }
.poliza__cabeza { display: flex; gap: .8rem; align-items: flex-start; }
.ramo { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; background: #EAF0FA; color: var(--tinta); }
.ramo svg { width: 1.45rem; height: 1.45rem; }
.poliza__titulos { display: grid; gap: .1rem; min-width: 0; flex: 1; }
.poliza__ramo { font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--tinta); }
.poliza__cia { color: var(--texto-suave); font-size: .95rem; }
.estado { flex: none; font-size: .85rem; font-weight: 700; padding: .2rem .6rem; border-radius: 99px; background: #E9ECF1; color: var(--texto-suave); }
.estado--vigente { background: var(--verde-fondo); color: #13603E; }
.poliza__bien { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: 1rem; }
.poliza__pie { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; font-size: .92rem; color: var(--texto-suave); }
.poliza__deuda { color: var(--rojo); font-weight: 700; }

/* Placa patente Mercosur */
.placa {
  display: inline-grid; grid-template-rows: auto auto; min-width: 7.2rem;
  border: 2px solid #1A1A1A; border-radius: 5px; overflow: hidden; background: #fff;
  font-family: var(--display); line-height: 1; vertical-align: middle;
}
.placa__banda { background: var(--placa-azul); color: #fff; font-size: .5rem; font-weight: 700; letter-spacing: .14em; text-align: center; padding: .14rem .3rem .12rem; }
.placa__numero { font-size: 1.12rem; font-weight: 700; letter-spacing: .1em; text-align: center; padding: .22rem .5rem .26rem; color: #111; }
.placa--grande { min-width: 10rem; }
.placa--grande .placa__banda { font-size: .62rem; }
.placa--grande .placa__numero { font-size: 1.6rem; }

/* Barra de vigencia */
.vigencia { display: grid; gap: .35rem; }
.vigencia__pista { position: relative; height: 6px; border-radius: 3px; background: #E3E7EE; }
.vigencia__avance { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--tinta); }
.vigencia__hoy { position: absolute; top: -4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--naranja); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--naranja); }
.vigencia__fechas { display: flex; justify-content: space-between; font-size: .85rem; color: var(--texto-suave); }

.vacio, .cargando { padding: 2rem 1rem; text-align: center; color: var(--texto-suave); }
.vacio h2 { font-size: 1.25rem; margin-bottom: .4rem; }
.cargando { display: flex; gap: .75rem; align-items: center; justify-content: center; }
.cargando__punto { width: .8rem; height: .8rem; border-radius: 50%; background: var(--naranja); animation: latido 1s ease-in-out infinite; }
@keyframes latido { 50% { transform: scale(.5); opacity: .5; } }

/* ---------- Hojas (diálogos) ---------- */
.hoja {
  width: 100%; max-width: 40rem; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: var(--radio-grande) var(--radio-grande) 0 0; background: var(--papel); color: var(--texto);
}
@media (min-width: 720px) { .hoja { margin: auto; border-radius: var(--radio-grande); } }
.hoja::backdrop { background: rgba(14, 26, 48, .55); }
.hoja[open] { animation: subir .22s ease-out; }
@keyframes subir { from { transform: translateY(24px); opacity: 0; } }
.hoja__cuerpo { position: relative; padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom)); display: grid; gap: 1.1rem; }
.hoja__cerrar {
  position: absolute; top: .75rem; right: .75rem; width: 2.5rem; height: 2.5rem;
  border: 0; border-radius: 50%; background: #EEF1F5; cursor: pointer; font-size: 1.5rem; line-height: 1; color: var(--tinta);
}
.hoja__titulo { font-size: 1.6rem; font-weight: 700; padding-right: 3rem; }
.hoja__subtitulo { margin: -.6rem 0 0; color: var(--texto-suave); }

#detalleContenido { display: grid; gap: 1.25rem; }
.detalle__cabeza { display: flex; gap: .9rem; align-items: center; padding-right: 3rem; }
.detalle__cabeza .ramo { width: 3.2rem; height: 3.2rem; }
.detalle__datos { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.detalle__datos dt { color: var(--texto-suave); }
.detalle__datos dd { margin: 0; font-weight: 700; }
.detalle__bienes { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.alerta-deuda { padding: .8rem 1rem; border-radius: var(--radio-chico); background: var(--rojo-fondo); color: #7D2416; }
.seccion { display: grid; gap: .6rem; padding-top: 1.1rem; border-top: 1px solid var(--linea); }
.seccion h3 { font-size: 1.15rem; }
.docs { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.doc {
  display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem;
  border: 1px solid var(--linea); border-radius: var(--radio-chico); text-decoration: none; color: inherit;
}
.doc:hover { border-color: var(--tinta-suave); background: #F7F9FC; }
.doc__icono { flex: none; width: 2.2rem; height: 2.6rem; border-radius: 4px; background: var(--rojo-fondo); color: var(--rojo); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: .7rem; }
.doc__texto { display: grid; min-width: 0; }
.doc__nombre { font-weight: 700; overflow-wrap: anywhere; }
.doc__meta { font-size: .88rem; color: var(--texto-suave); }
.acciones { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .acciones { grid-template-columns: 1fr 1fr; } }

/* ---------- Aviso flotante ---------- */
.aviso {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(92vw, 30rem); padding: .9rem 1.1rem; border-radius: var(--radio);
  background: var(--tinta); color: #fff; box-shadow: 0 10px 30px rgba(14,26,48,.3); z-index: 20;
}
.aviso b { color: #FFC28F; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
