/* Sistema de diseño: tokens de marca y componentes básicos. Primero móvil. */
:root {
  --color-marca: #ED6B1F;
  --color-marca-oscuro: #c7540f;
  --color-texto: #1f1f1f;
  --color-texto-suave: #5f5f5f;
  --color-fondo: #f6f4f1;
  --color-superficie: #ffffff;
  --color-borde: #e2ddd6;
  --color-ok: #2E9E5B;
  --color-error: #CC2C24;
  --color-info: #2b6cb0;
  --radio: 12px;
  --sombra: 0 1px 3px rgba(0, 0, 0, .08);
  --alto-toque: 48px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--color-texto);
  background: var(--color-fondo);
}
a { color: var(--color-marca-oscuro); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
code { background: #f0ece6; padding: .1em .35em; border-radius: 4px; word-break: break-all; }

.cabecera {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding: .6rem 1rem; background: var(--color-superficie); border-bottom: 1px solid var(--color-borde);
  padding-top: max(.6rem, env(safe-area-inset-top));
}
.marca { font-weight: 700; color: var(--color-marca); text-decoration: none; font-size: 1.1rem; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; margin-left: auto; }
.nav a { text-decoration: none; padding: .4rem .25rem; color: var(--color-texto-suave); }
.nav a.activo { color: var(--color-marca-oscuro); font-weight: 600; }
.inline { display: inline; }

.contenido { padding: 1rem; max-width: 960px; margin: 0 auto; padding-bottom: max(1rem, env(safe-area-inset-bottom)); }

.tarjeta {
  background: var(--color-superficie); border: 1px solid var(--color-borde); border-radius: var(--radio);
  padding: 1rem; margin-bottom: 1rem; box-shadow: var(--sombra);
}
.estrecha { max-width: 440px; margin: 1rem auto; }
.enlace-tarjeta { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; color: inherit; }
.enlace-tarjeta span { color: var(--color-texto-suave); font-size: .9rem; }
.rejilla { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.formulario { display: flex; flex-direction: column; gap: .9rem; }
.formulario label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .95rem; }
.formulario label.casilla { flex-direction: row; align-items: center; gap: .6rem; }
.formulario small, .ayuda { font-weight: 400; color: var(--color-texto-suave); font-size: .85rem; margin-top: -.5rem; }
input[type=text], input[type=email], input[type=password], select, textarea {
  font: inherit; padding: .65rem .75rem; border: 1px solid var(--color-borde); border-radius: 8px;
  min-height: var(--alto-toque); background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid rgba(237, 107, 31, .35); outline-offset: 1px; }

.boton {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--alto-toque);
  padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid var(--color-borde); background: #fff;
  color: var(--color-texto); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.boton.principal { background: var(--color-marca); border-color: var(--color-marca); color: #fff; }
.boton.secundario { background: transparent; }
.boton.peligro { border-color: var(--color-error); color: var(--color-error); }
.enlace { background: none; border: 0; padding: .4rem .25rem; color: var(--color-texto-suave); font: inherit; cursor: pointer; text-decoration: underline; }

.aviso { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.aviso-ok { background: #e9f7ee; border-color: var(--color-ok); color: #1d6a3b; }
.aviso-error { background: #fdecea; border-color: var(--color-error); color: #8f1d18; }
.aviso-info { background: #e8f0fb; border-color: var(--color-info); color: #1d4a7a; }
.nota { color: var(--color-texto-suave); font-size: .92rem; }
.centrado { text-align: center; }

.barra-titulo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.barra-titulo h1 { margin: 0; }
.acciones { display: flex; flex-direction: column; gap: .6rem; }
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filtros select { width: auto; flex: 1 1 180px; }

.tabla { width: 100%; border-collapse: collapse; background: var(--color-superficie); border-radius: var(--radio); overflow: hidden; font-size: .95rem; }
.tabla th, .tabla td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--color-borde); vertical-align: top; }
.tabla th { background: #faf8f5; font-weight: 600; }
.tabla tr.apagado { color: var(--color-texto-suave); }
.tabla .detalle { font-size: .85rem; color: var(--color-texto-suave); word-break: break-word; }
@media (max-width: 640px) {
  .tabla thead { display: none; }
  .tabla tr { display: block; padding: .5rem .25rem; }
  .tabla td { display: block; border: 0; padding: .15rem .5rem; }
}

.lista { padding-left: 1.2rem; }
.codigos { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.codigos code { display: block; padding: .5rem; text-align: center; font-size: 1.05rem; }
.enlace-copia code { display: block; padding: .75rem; }
.paginacion { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

/* --- Gastos --- */
.oculto { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.captura-boton { cursor: pointer; font-size: 1.1rem; padding: 1.2rem; }
.desactivado { opacity: .5; pointer-events: none; }
.lista-gastos { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.gasto-fila { display: flex; align-items: center; gap: .8rem; background: var(--color-superficie); border: 1px solid var(--color-borde); border-radius: var(--radio); padding: .6rem .8rem; text-decoration: none; color: inherit; }
.gasto-datos { display: flex; flex-direction: column; flex: 1; gap: .1rem; font-size: .95rem; }
.mini { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #eee; flex: none; }
.insignia { font-size: .75rem; padding: .2rem .55rem; border-radius: 999px; background: #eee; text-transform: capitalize; white-space: nowrap; }
.estado-borrador { background: #eeeae4; }
.estado-enviado { background: #e8f0fb; color: #1d4a7a; }
.estado-aprobado { background: #e9f7ee; color: #1d6a3b; }
.estado-rechazado { background: #fdecea; color: #8f1d18; }
.estado-pagado { background: #e9f7ee; color: #1d6a3b; font-weight: 600; }
.dos-columnas { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .dos-columnas { grid-template-columns: 2fr 3fr; align-items: start; } }
.columna-imagen { text-align: center; }
.justificante { max-width: 100%; max-height: 70vh; border-radius: 8px; border: 1px solid var(--color-borde); }
.fila-2 { display: grid; gap: .9rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .fila-2 { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--color-borde); border-radius: 10px; padding: .75rem; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
legend { font-weight: 600; padding: 0 .3rem; }
.acciones-fila { display: flex; gap: .6rem; flex-wrap: wrap; }
.acciones-fila .boton { flex: 1; }
.detalle { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.detalle dt { font-weight: 600; color: var(--color-texto-suave); }
.detalle dd { margin: 0; }
textarea { font: inherit; padding: .65rem .75rem; border: 1px solid var(--color-borde); border-radius: 8px; width: 100%; }
.semaforo { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; vertical-align: middle; }
.semaforo.verde { background: var(--color-ok); }
.semaforo.ambar { background: #e0a800; }
.semaforo.rojo { background: var(--color-error); }
progress.barra { display: block; width: 100%; height: .4rem; margin-top: .25rem; appearance: none; border: 0; border-radius: 999px; background: var(--color-borde); }
progress.barra::-webkit-progress-bar { background: var(--color-borde); border-radius: 999px; }
progress.barra::-webkit-progress-value { background: var(--color-marca); border-radius: 999px; }
progress.barra::-moz-progress-bar { background: var(--color-marca); border-radius: 999px; }
.desplazable { overflow-x: auto; }
