/* Organizador GVP — móvil primero. Sin estilos en línea (CSP style-src 'self'). */
:root {
  --fondo: #f6f5f1;
  --superficie: #ffffff;
  --texto: #1f2328;
  --suave: #5b636d;
  --borde: #dcd9d0;
  --acento: #1f5f8b;
  --acento-texto: #ffffff;
  --acento-suave: #e6eff6;
  --ok: #1d6b3a;
  --ok-fondo: #e5f3ea;
  --error: #a1261b;
  --error-fondo: #fbe9e7;
  --aviso: #7a5200;
  --aviso-fondo: #fff4d6;
  --radio: 10px;
  --sombra: 0 1px 2px rgb(0 0 0 / 6%);
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #15181c;
    --superficie: #1e2227;
    --texto: #e8e6e1;
    --suave: #a3abb5;
    --borde: #353b43;
    --acento: #6aa8d6;
    --acento-texto: #0d1a24;
    --acento-suave: #1d2c38;
    --ok: #7fd09b;
    --ok-fondo: #18301f;
    --error: #ff9a8f;
    --error-fondo: #3a1d1a;
    --aviso: #f3c969;
    --aviso-fondo: #33290f;
    --sombra: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--acento); }
h1 { font-size: 1.4rem; margin: .2rem 0 1rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: .2rem 0 .4rem; }
p { margin: .4rem 0; }

/* Barra superior y menú */
.barra {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .6rem 1rem; background: var(--superficie); border-bottom: 1px solid var(--borde);
}
.marca { font-weight: 700; text-decoration: none; color: var(--texto); }
.quien { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--suave); min-width: 0; }
.quien span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9rem; }
.menu {
  display: flex; gap: .25rem; overflow-x: auto; padding: .4rem 1rem; background: var(--superficie);
  border-bottom: 1px solid var(--borde); scrollbar-width: none;
}
.menu a {
  flex: 0 0 auto; padding: .35rem .7rem; border-radius: 999px; text-decoration: none;
  color: var(--texto); font-size: .9rem;
}
.menu a.activo, .menu a:hover { background: var(--acento-suave); color: var(--acento); }
main { max-width: 960px; margin: 0 auto; padding: 1rem; }

/* Mensajes */
.mensaje { padding: .7rem .9rem; border-radius: var(--radio); margin: 0 0 .8rem; }
.mensaje.ok { background: var(--ok-fondo); color: var(--ok); }
.mensaje.error { background: var(--error-fondo); color: var(--error); }
.mensaje.aviso { background: var(--aviso-fondo); color: var(--aviso); }
.mensaje ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* Tarjetas */
.tarjetas { display: grid; gap: .7rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .tarjetas.dos { grid-template-columns: 1fr 1fr; } }
.tarjeta {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: .9rem 1rem; box-shadow: var(--sombra); min-width: 0;
}
a.tarjeta { display: block; color: inherit; text-decoration: none; }
a.tarjeta:hover { border-color: var(--acento); }
.tarjeta .titulo { font-weight: 600; overflow-wrap: anywhere; }
.tarjeta .detalle { color: var(--suave); font-size: .9rem; overflow-wrap: anywhere; }
.fila { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; }
.etiquetas { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.etiqueta {
  display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem;
  background: var(--acento-suave); color: var(--acento); white-space: nowrap;
}
.etiqueta.alerta { background: var(--aviso-fondo); color: var(--aviso); }
.etiqueta.mal { background: var(--error-fondo); color: var(--error); }
.etiqueta.bien { background: var(--ok-fondo); color: var(--ok); }
.etiqueta.gris { background: var(--fondo); color: var(--suave); border: 1px solid var(--borde); }
dl.datos { display: grid; grid-template-columns: 1fr; gap: .1rem .9rem; margin: .3rem 0; }
dl.datos dt { color: var(--suave); font-size: .82rem; margin-top: .45rem; }
dl.datos dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
@media (min-width: 720px) {
  dl.datos { grid-template-columns: 12rem 1fr; }
  dl.datos dt { margin-top: 0; }
}
.vacio { color: var(--suave); font-style: italic; }

/* Formularios por secciones */
form.seccionado fieldset, fieldset.seccion {
  border: 1px solid var(--borde); border-radius: var(--radio); background: var(--superficie);
  padding: .8rem 1rem 1rem; margin: 0 0 1rem; min-width: 0;
}
legend { font-weight: 600; padding: 0 .3rem; }
.campo { margin: .7rem 0 0; }
.campo > label, .campo > .etiqueta-campo { display: block; font-weight: 500; margin-bottom: .25rem; }
.ayuda { color: var(--suave); font-size: .82rem; margin-top: .2rem; }
.error-campo { color: var(--error); font-size: .85rem; margin-top: .25rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date],
input[type=time], input[type=number], input[type=month], select, textarea {
  width: 100%; padding: .6rem .7rem; font: inherit; color: var(--texto); background: var(--fondo);
  border: 1px solid var(--borde); border-radius: 8px; min-height: 44px;
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--acento); outline-offset: 1px;
}
.invalido input, .invalido select, .invalido textarea { border-color: var(--error); }
.dos-columnas { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .dos-columnas { grid-template-columns: 1fr 1fr; } }
.opciones { display: grid; gap: .35rem; }
.opcion { display: flex; align-items: flex-start; gap: .55rem; min-height: 32px; }
.opcion input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; flex: 0 0 auto; }
.lista-scroll { max-height: 18rem; overflow-y: auto; border: 1px solid var(--borde); border-radius: 8px; padding: .5rem; }

/* Botones */
.acciones { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; align-items: center; }
button, .boton {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: .55rem 1.1rem; border-radius: 8px; border: 1px solid var(--acento);
  background: var(--acento); color: var(--acento-texto); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.boton.secundario, button.secundario { background: transparent; color: var(--acento); }
button.peligro, .boton.peligro { background: var(--error); border-color: var(--error); color: #fff; }
button.enlace { background: none; border: 0; color: var(--acento); padding: 0; min-height: 0; font-weight: 500;
  text-decoration: underline; }
form.en-linea { display: inline; }

/* Tablas que pasan a tarjetas en teléfono */
table.tabla { width: 100%; border-collapse: collapse; background: var(--superficie); border-radius: var(--radio); }
table.tabla th, table.tabla td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--borde);
  vertical-align: top; font-size: .9rem; }
@media (max-width: 719px) {
  table.tabla, table.tabla tbody, table.tabla tr, table.tabla td { display: block; width: 100%; }
  table.tabla thead { display: none; }
  table.tabla tr { border: 1px solid var(--borde); border-radius: var(--radio); margin-bottom: .6rem;
    padding: .4rem .2rem; background: var(--superficie); }
  table.tabla td { border: 0; padding: .2rem .6rem; }
  table.tabla td::before { content: attr(data-th); display: block; color: var(--suave); font-size: .75rem; }
}
code.uuid { font-size: .75rem; overflow-wrap: anywhere; }

/* Calendario */
.dia { margin-bottom: .9rem; }
.dia h3 { position: sticky; top: 0; background: var(--fondo); padding: .3rem 0; margin: 0; }
.dia.hoy h3 { color: var(--acento); }
.evento { border-left: 4px solid var(--acento); }
.navegacion-mes { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }

/* Propuesta */
.propuesta { border-left: 4px solid var(--ok); }
.descarte { border-left: 4px solid var(--error); }
.deficit { font-weight: 600; }
.centrado { max-width: 420px; margin: 1.5rem auto; }
.pie { color: var(--suave); font-size: .8rem; text-align: center; padding: 2rem 1rem; }
.oculto { display: none; }
