/* Componentes comunes a la app del AGH team, el portal y el formulario de equipo.
   Líneas antes que tarjetas, un solo rojo de acción por pantalla, estados como
   texto con icono y sin emojis. Sin estilos en línea: la CSP no los permite. */

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 24px;
}
a { color: var(--ink); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--red-dark); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.col { max-width: 760px; margin: 0 auto; padding: 0 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Cabecera */
.top { border-bottom: 1px solid var(--line); background: var(--paper); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 16px; }
.mark { width: 22px; height: 22px; border: 3px solid var(--red); border-radius: 6px; display: block; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.top nav a, .top nav button.enlace {
  font: inherit; font-size: 14px; text-decoration: none; color: var(--muted); padding: 8px 12px;
  border-radius: 104px; min-height: 40px; display: inline-flex; align-items: center;
  background: none; border: 0; cursor: pointer;
}
.top nav a:hover, .top nav button.enlace:hover { background: var(--hover); color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.quien { font-size: 14px; color: var(--muted); padding: 0 8px; }

/* Tipografía */
h1.display { font-family: var(--display); font-weight: 400; font-size: 32px; line-height: 1.1; color: var(--ink); margin: 0; }
h2 { font-size: 22px; line-height: 28px; font-weight: 600; color: var(--ink); margin: 0; }
h3 { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); margin: 0; }
p { margin: 0; }
.lead { font-size: 19px; line-height: 29px; }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 20px; }
.label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }
.sq { width: 7px; height: 7px; background: var(--red); display: inline-block; }

/* Botones: un solo .primary por pantalla */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 24px; border-radius: 104px; font: inherit; font-size: 16px; font-weight: 600;
  cursor: pointer; text-decoration: none; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); transition: transform 150ms ease-out;
}
.btn:hover { background: #f6f5f2; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--red-dark); border-color: var(--red-dark); color: #ffffff; }
.btn.primary:hover { background: var(--red-press); border-color: var(--red-press); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--error); border-color: var(--error); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* Formularios */
.form { display: flex; flex-direction: column; gap: 28px; padding: 24px 0 40px; }
.fld { display: flex; flex-direction: column; gap: 8px; }
.fld > label, .q { font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ink); }
.help { font-size: 14px; line-height: 20px; color: var(--muted); margin: 0; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=search], select, textarea {
  /* Borde --line-strong y no --line como el prototipo: contraste 3:1 (WCAG 1.4.11) */
  width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px 12px;
  font: inherit; font-size: 16px; background: var(--surface); color: var(--ink);
}
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
textarea { resize: vertical; min-height: 110px; }
.err { font-size: 14px; line-height: 20px; color: var(--error); margin: 0; display: flex; gap: 6px; }
.has-err input, .has-err select, .has-err textarea { border-color: var(--error); }

/* Estados como texto con icono */
.st { display: inline-flex; gap: 6px; font-weight: 600; white-space: nowrap; }
.st.ok { color: var(--success); }
.st.info { color: var(--info); }
.st.warn { color: var(--warning); }
.st.error { color: var(--error); }
.notice { border-radius: 6px; padding: 14px 16px; font-size: 14px; line-height: 20px; display: flex; gap: 10px; }
.notice.warn { background: var(--warning-soft); color: var(--warning); }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.error { background: var(--error-soft); color: var(--error); }

/* Cabecera de página y tablas */
.panelhead { padding: 48px 0 24px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.panelhead > div { display: flex; flex-direction: column; gap: 8px; }
.tablebox { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
th { text-align: left; font-weight: 400; color: var(--muted); padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: top; }
tr.rowlink:hover td { background: var(--hover); }
.num { font-variant-numeric: tabular-nums; }
.empty { padding: 72px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.bigmark { width: 56px; height: 56px; border: 6px solid var(--red); border-radius: 14px; }
.sec { padding: 28px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }

/* Rejillas y casillas */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.check-inline { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; color: var(--ink); }
.check-inline input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--red-dark); flex-shrink: 0; }

/* Listados */
.barra-busqueda { max-width: 420px; margin-bottom: 16px; }
.vacio { padding: 24px 0; }
.mas { padding: 24px 0 96px; }

/* Pestañas de la ficha */
.pestanas { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.pestanas a {
  font-size: 14px; text-decoration: none; color: var(--muted); padding: 10px 14px; min-height: 44px;
  display: inline-flex; align-items: center; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.pestanas a:hover { color: var(--ink); }
.pestanas a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--red); }

/* Personas (contactos, respuestas de equipo) */
.persona {
  padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap;
  gap: 12px; justify-content: space-between; align-items: center;
}
.persona > div { min-width: 0; overflow-wrap: anywhere; }
.nota-interna { background: var(--beige); border-radius: 6px; padding: 8px 12px; margin-top: 4px; }
.persona h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.contacto-nuevo { padding-top: 8px; }
#pestana > .sec:first-child { border-top: 0; }

/* Opciones del briefing (como el prototipo) */
.opt-tag { font-weight: 400; color: var(--muted); }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); cursor: pointer; color: var(--ink);
  transition: border-color 150ms ease-out;
}
.opt:hover { border-color: var(--line-strong); }
.opt input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--red-dark); flex-shrink: 0; }
.opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt:has(input:disabled) { cursor: default; }
fieldset.fld, fieldset.group { border: 0; margin: 0; padding: 0; min-width: 0; }
.opt, fieldset, legend { font-family: var(--body); font-size: 16px; line-height: 24px; }
fieldset.fld > legend, fieldset.group > legend { padding: 0; margin-bottom: 10px; }
.group + .group { margin-top: 16px; }

/* Briefing */
.briefing-cabecera {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end;
  padding: 24px 0 8px;
}
.briefing-cabecera > div { display: flex; flex-direction: column; gap: 6px; }
.bloque { gap: 24px; }
.estado-guardado { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 100%; }
.estado-guardado .st { white-space: normal; }
.nota-consultor { background: var(--beige); border-radius: 10px; padding: 16px; }
.acciones-briefing { padding: 24px 0 96px; border-top: 1px solid var(--line); }

/* Asistente por pasos (formulario de equipo, como el prototipo) */
.progress { padding: 40px 0 8px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 12px; padding: 0; list-style: none; font-size: 14px; line-height: 20px; color: var(--muted); }
.steps li.on { color: var(--ink); font-weight: 600; }
.steps li.done { color: var(--success); }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar span { display: block; height: 4px; background: var(--red); transition: width 300ms ease-out; }
.stephead { padding: 40px 0 8px; display: flex; flex-direction: column; gap: 8px; }
.stephead.entrada { padding-top: 56px; }
.stephead .count { font-size: 14px; color: var(--muted); }
.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 24px 0 96px; }
.saved { font-size: 14px; color: var(--muted); }
.final { padding: 96px 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 24px; }
.final .bigmark { width: 72px; height: 72px; border-width: 8px; border-radius: 18px; }
.privacidad { font-size: 14px; color: var(--text); }
.privacidad summary { cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.privacidad p { margin-top: 8px; }
/* Campo trampa: fuera de la vista; solo lo rellenan los robots */
.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Equipo del cliente (ficha) */
.enlace-nuevo { display: flex; flex-wrap: wrap; gap: 8px; }
.enlace-nuevo input { flex: 1 1 280px; }
.kv { display: grid; grid-template-columns: minmax(140px, 260px) 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 8px; } }
/* Ficha a dos columnas (propuesta) */
.detalle { display: flex; flex-wrap: wrap; gap: 48px; padding-bottom: 96px; }
.detalle-main { flex: 999 1 480px; min-width: 0; }
.detalle-lateral { flex: 1 1 360px; min-width: 0; }
.fn { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.fn-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.fn-top b { color: var(--ink); }
.count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; white-space: nowrap; }
ul.plain { margin: 0; padding-left: 20px; }
.anadir summary { cursor: pointer; font-weight: 600; color: var(--ink); padding: 8px 0; }
.persona.vencido h3 { color: var(--error); }

/* Vista general */
.kpis { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.kpi { background: var(--beige); border-radius: 10px; padding: 20px 24px; min-width: 200px; flex: 1 1 200px; }
.kpi b.num { display: block; font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1; color: var(--ink); margin-bottom: 6px; }
.por-nivel { margin-top: 8px; }
.filtros { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; padding-bottom: 16px; }
.filtros .fld { flex: 1 1 180px; gap: 4px; }
.mini-itinerario { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; min-width: 160px; }
.texto-largo { white-space: pre-wrap; }
.respuesta-equipo { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }

/* Itinerario */
.itinerario-cabecera { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; padding: 24px 0 8px; }
.itinerario-cabecera > div:first-child { display: flex; flex-direction: column; gap: 6px; flex: 1 1 320px; min-width: 0; }
.itinerario-cabecera h2 { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.titulo-fase { font-size: 19px; line-height: 26px; }
ol.subfases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.subfase { border-left: 3px solid var(--line); padding: 12px 0 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.subfase h4 { margin: 0; font-size: 16px; color: var(--ink); }
.criterios { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.fase label > input, .fase label > textarea, .fase label > select { margin-top: 6px; }
.fase .fld > label { display: flex; flex-direction: column; }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink);
  color: #ffffff; padding: 12px 20px; border-radius: 10px; font-size: 14px;
  max-width: calc(100vw - 32px); text-align: center;
  box-shadow: 0 12px 32px rgba(20, 20, 19, 0.16); z-index: 11;
}

footer { border-top: 1px solid var(--line); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; padding: 24px; font-size: 14px; color: var(--muted); }

/* Acceso */
.acceso { max-width: 420px; margin: 0 auto; padding: 96px 24px; display: flex; flex-direction: column; gap: 24px; }

@media (max-width: 640px) {
  h1.display { font-size: 26px; }
  .acceso { padding-top: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
