/* Consorcios — interfaz.
   Idea visual: la placa de latón del portero eléctrico. Cada unidad se identifica con una placa;
   el resto es sobrio (granito claro, tinta petróleo) para que la placa sea lo único que brilla. */

:root {
  --granito: #e6e8e7;
  --papel: #fbfbfa;
  --petroleo: #1b424d;
  --petroleo-hondo: #143540;
  --tinta: #16303a;
  --suave: #51666d;
  --linea: #cbd1cf;
  --laton-1: #dcbb6c;
  --laton-2: #c39c42;
  --laton-borde: #8a6a1f;
  --laton-texto: #33260a;
  --error: #a32d2d;
  --error-fondo: #f8e4e4;
  --ok: #2f6b4f;
  --ok-fondo: #e3f1ea;
  --falta: #8a3b12;
  --falta-fondo: #fcebdd;
  --foco: #0b6bcb;
  --radio: 6px;
  --texto: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --condensada: 'Barlow Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--granito);
  color: var(--tinta);
  font-family: var(--texto);
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--condensada); font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 .75rem; }
a { color: var(--petroleo); }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
.cabecera :focus-visible, .nav-admin :focus-visible { outline-color: #fff; }

.carga-inicial { padding: 2rem 1rem; text-align: center; color: var(--suave); }

.contenedor { width: 100%; max-width: 70rem; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }

.saltar {
  position: absolute; left: .5rem; top: -4rem; background: #fff; color: var(--tinta);
  padding: .5rem .75rem; border-radius: var(--radio); z-index: 20;
}
.saltar:focus { top: .5rem; }

/* ------------------------------------------------------------ la placa */

.placa {
  display: inline-block;
  min-width: 2.4em;
  padding: .3em .6em .22em;
  font-family: var(--condensada);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: .03em;
  text-align: center;
  white-space: nowrap;
  color: var(--laton-texto);
  background: linear-gradient(180deg, var(--laton-1), var(--laton-2));
  border: 1px solid var(--laton-borde);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(0, 0, 0, .12), 0 1px 0 rgba(0, 0, 0, .1);
}
.placa-chica { font-size: 1rem; }
.placa-grande { font-size: 3.4rem; padding: .16em .45em .1em; border-width: 2px; border-radius: 4px; }
.placa-marca { font-size: 1.15rem; letter-spacing: .06em; }

/* ------------------------------------------------------------ cabecera */

.cabecera { background: var(--petroleo); color: #fff; }
.cabecera-fila { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; }
.marca { text-decoration: none; display: inline-flex; }
.cabecera-usuario { display: flex; align-items: center; gap: 1rem; font-size: .95rem; }
.nombre-usuario { display: none; opacity: .85; }
.enlace-cab {
  background: none; border: 0; padding: .35rem 0; color: #fff; font: inherit; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

.nav-admin { background: var(--petroleo-hondo); }
.nav-lista { display: flex; gap: .25rem; overflow-x: auto; }
.nav-lista a {
  color: #dfe9ec; text-decoration: none; font-family: var(--condensada); font-weight: 600; font-size: 1.15rem;
  padding: .7rem .75rem .55rem; border-bottom: 4px solid transparent; white-space: nowrap;
}
.nav-lista a:hover { color: #fff; }
.nav-lista a[aria-current='page'] { color: #fff; border-bottom-color: var(--laton-2); }

main.contenedor { padding-top: 1.5rem; padding-bottom: 3rem; outline: none; }

/* -------------------------------------------------------- piezas comunes */

.titulo-vista { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: 1rem; }
.barra { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1.25rem; margin-bottom: 1rem; }
.resumen { color: var(--suave); margin: 0 0 .75rem; }
.suave { color: var(--suave); }
.chico { font-size: .875rem; }

.panel {
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  padding: .25rem 1.25rem;
}
.panel-form { padding: 1rem 1.25rem 1.25rem; margin-bottom: 1.25rem; }
.panel-form h2 { margin-bottom: .75rem; }
.cargando { color: var(--suave); padding: 1rem 0; margin: 0; }

.campo-inline, .campo { display: flex; flex-direction: column; gap: .25rem; }
.campo { margin-bottom: .9rem; }
label, .etiqueta-campo { font-weight: 600; font-size: .95rem; }
.ayuda { color: var(--suave); font-size: .875rem; }

input[type='text'], input[type='email'], input[type='password'], select {
  font: inherit; color: var(--tinta); background: #fff;
  border: 1px solid #7d8c90; border-radius: 4px; padding: .5rem .6rem; min-height: 2.5rem; width: 100%;
}
input[type='file'] { font: inherit; max-width: 100%; }
select { width: auto; max-width: 100%; }
.periodo { display: flex; gap: .5rem; }
.periodo select { min-width: 7rem; }

.grilla-form { display: grid; gap: 0 1.25rem; grid-template-columns: 1fr; }

.btn {
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; text-align: center;
  min-height: 2.5rem; padding: .4rem .95rem; border-radius: 4px; border: 1px solid #7d8c90;
  background: #fff; color: var(--tinta);
}
.btn:hover { background: #f0f3f2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--petroleo); border-color: var(--petroleo); color: #fff; }
.btn-primario:hover { background: var(--petroleo-hondo); }
.btn-chico { min-height: 2.1rem; padding: .2rem .7rem; font-size: .9rem; }
.btn-peligro { color: var(--error); border-color: #cf9c9c; }
.btn-peligro:hover { background: var(--error-fondo); }
.btn-peligro-lleno { background: var(--error); border-color: var(--error); color: #fff; }
.btn-peligro-lleno:hover { background: #8a2424; }

.etiqueta {
  display: inline-block; font-size: .85rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; white-space: nowrap;
}
.etiqueta-ok { color: var(--ok); background: var(--ok-fondo); }
.etiqueta-falta { color: var(--falta); background: var(--falta-fondo); }
.etiqueta-neutra { color: var(--suave); background: #e9edec; }

.vacio { padding: 2rem 0; max-width: 34rem; }
.vacio h2 { margin-bottom: .4rem; }

.form-error, .error-linea {
  color: var(--error); background: var(--error-fondo); border-left: 4px solid var(--error);
  padding: .5rem .75rem; margin: .5rem 0 0; border-radius: 0 4px 4px 0;
}

/* ------------------------------------------------------- tablero de expensas */

.tablero { list-style: none; margin: 0; padding: 0; }
.fila-unidad {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .5rem 1rem; align-items: center;
  padding: .85rem 0; border-top: 1px solid var(--linea);
}
.fila-unidad:first-child { border-top: 0; }
.fila-unidad .quien { min-width: 0; }
.fila-unidad .quien strong { font-weight: 600; }
.fila-unidad .estado-carga { grid-column: 1 / -1; min-width: 0; }
.archivo-nombre { overflow-wrap: anywhere; }

/* --------------------------------------------------------------- tablas */

.tabla-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; padding: .7rem .6rem .7rem 0; border-top: 1px solid var(--linea); }
thead th { border-top: 0; font-size: .9rem; color: var(--suave); font-weight: 600; white-space: nowrap; }
td.acciones, th.acciones { text-align: right; white-space: nowrap; padding-right: 0; }
td.acciones .btn + .btn { margin-left: .35rem; }
.placas { display: flex; flex-wrap: wrap; gap: .35rem; }
.lista-simple { margin: 0; padding: 0; list-style: none; }

/* ------------------------------------------------------- selector de unidades */

.check-grilla { display: flex; flex-wrap: wrap; gap: .5rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; cursor: pointer; padding: .25rem .5rem; border: 1px solid var(--linea); border-radius: 4px; background: #fff; }
.check input { width: 1.1rem; height: 1.1rem; margin: 0; }
fieldset { border: 1px solid var(--linea); border-radius: var(--radio); margin: 0 0 .75rem; padding: .5rem .75rem .75rem; min-width: 0; }
legend { font-weight: 600; padding: 0 .35rem; }
.unidades-check { max-height: 15rem; overflow: auto; margin-bottom: .9rem; }

/* -------------------------------------------------------------- consorcista */

.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; padding: .5rem 0 1.25rem; }
.hero h1 { font-size: 2.1rem; }
.hero p { margin: .15rem 0 0; color: var(--suave); }

.selector-unidades { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.selector-unidades button {
  background: none; border: 0; padding: .25rem; cursor: pointer; border-radius: 6px; text-align: center; font: inherit; color: var(--tinta);
}
.selector-unidades button .placa { display: block; }
.selector-unidades button small { display: block; font-size: .8rem; color: var(--suave); margin-top: .2rem; max-width: 8rem; overflow-wrap: anywhere; }
.selector-unidades button[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--petroleo); background: #fff; }

.pestanas { display: flex; gap: .25rem; border-bottom: 2px solid var(--linea); margin-bottom: 1rem; }
.pestanas button {
  font-family: var(--condensada); font-weight: 600; font-size: 1.2rem; color: var(--suave);
  background: none; border: 0; border-bottom: 4px solid transparent; margin-bottom: -2px; padding: .5rem .9rem .4rem; cursor: pointer;
}
.pestanas button[aria-selected='true'] { color: var(--tinta); border-bottom-color: var(--petroleo); }

.grupo-titulo { margin: .75rem 0 .15rem; }
.grupo + .grupo .grupo-titulo { margin-top: 1.5rem; }
.docs { list-style: none; margin: 0; padding: 0; }
.doc {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem 1rem; align-items: center;
  padding: .8rem 0; border-top: 1px solid var(--linea);
}
.doc:first-child { border-top: 0; }
.doc .titulo-doc { font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; }
.doc .meta { color: var(--suave); font-size: .9rem; overflow-wrap: anywhere; }
.doc .acciones { display: flex; flex-wrap: wrap; gap: .5rem; }

/* -------------------------------------------------------------------- acceso */

.acceso { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.acceso-panel {
  width: 100%; max-width: 26rem; background: var(--petroleo); color: #fff; border-radius: 8px; padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 10px 30px rgba(20, 53, 64, .25);
}
.acceso-panel .placa { margin-bottom: 1.25rem; }
.acceso-panel h1 { font-size: 2rem; margin-bottom: .35rem; }
.acceso-panel .intro { color: #cfdde1; margin-bottom: 1.25rem; }
.acceso-panel label { color: #fff; }
.acceso-panel .ayuda { color: #cfdde1; }
.acceso-panel :focus-visible { outline-color: #fff; }
.acceso-panel .btn-primario { background: var(--laton-2); border-color: var(--laton-borde); color: var(--laton-texto); width: 100%; min-height: 2.9rem; font-size: 1.05rem; }
.acceso-panel .btn-primario:hover { background: var(--laton-1); }
.acceso-panel .form-error { background: #f8e4e4; }
.campo-clave { position: relative; }
.campo-clave input { padding-right: 5.5rem; }
.campo-clave button {
  position: absolute; right: .25rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; font: inherit; font-size: .9rem; font-weight: 600; color: var(--petroleo); cursor: pointer; padding: .4rem .6rem;
}
.acceso-panel .campo { margin-bottom: 1rem; }
.form-ok {
  color: var(--ok); background: var(--ok-fondo); border-left: 4px solid var(--ok);
  padding: .5rem .75rem; margin: .5rem 0 0; border-radius: 0 4px 4px 0;
}
.acceso-pie { margin: 1.25rem 0 0; font-size: .95rem; text-align: center; }
.acceso-pie a { color: #fff; }

.panel-cuenta { max-width: 30rem; }

/* ----------------------------------------------------------------- diálogos */

dialog.modal {
  border: 0; border-radius: 8px; padding: 0; width: calc(100% - 2rem); max-width: 34rem; color: var(--tinta); background: var(--papel);
  box-shadow: 0 20px 60px rgba(20, 53, 64, .35);
}
dialog.modal::backdrop { background: rgba(22, 48, 58, .55); }
.modal-form { padding: 1.25rem 1.25rem 1rem; }
.modal-form h2 { margin-bottom: 1rem; }
.modal-pie { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

/* ------------------------------------------------------------------- avisos */

.avisos { position: fixed; left: 0; right: 0; bottom: 1rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 0 1rem; pointer-events: none; z-index: 50; }
.aviso {
  pointer-events: auto; max-width: 32rem; padding: .7rem 1rem; border-radius: 6px; font-weight: 500;
  background: var(--petroleo-hondo); color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.aviso-error { background: var(--error); }

/* -------------------------------------------------------------- pantallas anchas */

@media (min-width: 640px) {
  .nombre-usuario { display: inline; }
  .grilla-form { grid-template-columns: 1fr 1fr; }
  .grilla-form .completo { grid-column: 1 / -1; }
  .fila-unidad { grid-template-columns: 5.5rem minmax(0, 1fr) minmax(0, 1.3fr); }
  .fila-unidad .estado-carga { grid-column: auto; }
  .doc { grid-template-columns: minmax(0, 1fr) auto; }
}

@media (min-width: 900px) {
  h1 { font-size: 2.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* Consorcistas de una unidad: nombre arriba y correo abajo, uno por persona. */
.personas { display: flex; flex-direction: column; gap: .55rem; }
.persona { display: flex; flex-direction: column; line-height: 1.3; overflow-wrap: anywhere; }
.persona-nombre { font-weight: 600; }
.persona-correo { color: var(--suave); font-size: .92rem; }
