/* Identidad visual de Candina Group (misma que el portal de publicaciones):
   marino #213559 (acento) · tinta #0E1317 · texto #6D7A8E · superficies #F3F3F5 */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --marino: #213559;
  --marino-oscuro: #182843;
  --marino-suave: #2e4570;
  --tinta: #0e1317;
  --texto: #26303d;
  --gris: #6d7a8e;
  --superficie: #f3f3f5;
  --tarjeta: #ffffff;
  --borde: #e2e5ea;
  --verde: #2e7d4f;
  --rojo: #b3423a;
  --ambar: #8a6d1f;
  --sombra: 0 1px 2px rgba(33, 53, 89, 0.06), 0 8px 24px -12px rgba(33, 53, 89, 0.18);
  --radio: 12px;
}

body {
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--superficie);
  color: var(--texto);
  min-height: 100dvh;
  line-height: 1.55;
}

h1, h2, h3 {
  font-family: "Poppins", "Open Sans", system-ui, sans-serif;
  color: var(--tinta);
  letter-spacing: -0.015em;
  line-height: 1.25;
  text-wrap: balance;
}

a { color: var(--marino); }
.muted { color: var(--gris); }

/* --- Cabecera --- */

header.barra {
  background: var(--marino);
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  box-shadow: 0 2px 12px rgba(14, 19, 23, 0.25);
}

.marca-cabecera { display: flex; align-items: center; gap: 0.7rem; }
.marca-cabecera img { height: 42px; width: 42px; }
.marca-cabecera .titulo {
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}
.marca-cabecera .subtitulo {
  display: block;
  font-family: "Open Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  color: #aebad0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

header.barra nav { display: flex; gap: 1.1rem; align-items: center; font-size: 0.9rem; }
header.barra a {
  color: #d5deee;
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
header.barra a:hover { color: #fff; }
header.barra a.activo { color: #fff; border-bottom-color: #fff; }

main { max-width: 1240px; margin: 2.5rem auto 3.5rem; padding: 0 1.25rem; }

.encabezado-pagina { margin-bottom: 1.5rem; }
.encabezado-pagina h2 { font-size: 1.45rem; }
.encabezado-pagina p { color: var(--gris); max-width: 72ch; margin-top: 0.35rem; }

/* --- Tarjetas --- */

.tarjeta {
  background: var(--tarjeta);
  border-radius: var(--radio);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--sombra);
}
.tarjeta h2, .tarjeta h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }

/* --- Formularios --- */

input[type="text"], input[type="password"], select {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font: inherit;
  color: var(--texto);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:hover, select:hover { border-color: #c3cad6; }
input:focus, select:focus {
  outline: none;
  border-color: var(--marino);
  box-shadow: 0 0 0 3px rgba(33, 53, 89, 0.15);
}
input::placeholder { color: #a3adbd; }

.filtros { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.filtros input[type="text"] { flex: 2 1 240px; }
.filtros select { flex: 1 1 190px; max-width: 340px; }

/* --- Botones --- */

.boton {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 1.4rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--marino);
  color: #fff;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 2px rgba(14, 19, 23, 0.15);
}
.boton:hover { background: var(--marino-suave); box-shadow: 0 3px 10px -2px rgba(33, 53, 89, 0.4); }
.boton:active { transform: scale(0.98); }
.boton:focus-visible { outline: 3px solid rgba(33, 53, 89, 0.35); outline-offset: 2px; }
.boton:disabled { opacity: 0.5; cursor: wait; }
.boton.gris { background: #5d6c81; }
.boton.gris:hover { background: #6b7b92; }
.boton.pequeno { padding: 0.45rem 1rem; font-size: 0.88rem; }

/* --- Avisos y etiquetas --- */

.aviso, .fallo {
  padding: 0.85rem 1.1rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-size: 0.93rem;
}
.fallo { background: #f9eae9; color: #7e2d27; border: 1px solid #ecc8c5; }
.aviso { background: #e8f3ec; color: #1e5637; border: 1px solid #c5e0d0; }

/* --- Formularios de posts --- */
label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--tinta);
  margin: 1.1rem 0 0.35rem;
}
label .opcional { font-weight: 400; color: var(--gris); }
label .req { color: var(--rojo); }
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font: inherit;
  color: var(--texto);
  background: #fff;
  resize: vertical;
  min-height: 92px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea:hover { border-color: #c3cad6; }
textarea:focus { outline: none; border-color: var(--marino); box-shadow: 0 0 0 3px rgba(33, 53, 89, 0.15); }
input[type="file"] { display: block; font-size: 0.9rem; color: var(--gris); margin-top: 0.2rem; }
input[type="text"] { width: 100%; }
.filtros input[type="text"] { width: auto; }

.boton.rojo { background: var(--rojo); }
.boton.rojo:hover { background: #c25049; }
.acciones { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.miniatura {
  max-width: 240px; max-height: 170px; border-radius: 8px;
  display: block; margin: 0.6rem 0; box-shadow: var(--sombra);
}

.etiqueta {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.65rem;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.etiqueta.vigente { background: #e2f0e8; color: var(--verde); }
.etiqueta.caducado { background: #f9e7e5; color: var(--rojo); }
.etiqueta.caduca-pronto { background: #f5edd7; color: var(--ambar); }
.etiqueta.sin-caducidad, .etiqueta.sin-fecha { background: #e9ecf1; color: var(--gris); }

.meta { color: var(--gris); font-size: 0.85rem; margin-bottom: 0.6rem; }

/* --- Tablas --- */

.table-wrap {
  overflow-x: auto;
  background: var(--tarjeta);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--borde);
  vertical-align: top;
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }
thead th {
  color: var(--gris);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  background: var(--tarjeta);
}
tbody tr { transition: background 0.15s ease; }
tbody tr:hover { background: #f7f8fa; }
tbody tr.enlace { cursor: pointer; }

.vacio { text-align: center; padding: 2.5rem 1rem; color: var(--gris); }

.pager { display: flex; gap: 1rem; align-items: center; margin: 1.25rem 0; color: var(--gris); }

/* --- Ficha de tripulante --- */

.cards { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.cards .tarjeta { flex: 1 1 320px; margin-bottom: 0; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1.2rem; margin-top: 0.6rem; }
dt { color: var(--gris); font-size: 0.9rem; }
dd { font-size: 0.93rem; }
h2.seccion { margin: 1.75rem 0 0.9rem; font-size: 1.2rem; }

/* --- Chat --- */

#chat-box {
  background: var(--tarjeta);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  min-height: 340px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 1.25rem;
  margin-bottom: 0.9rem;
}
.bubble { max-width: 95%; margin: 0.6rem 0; padding: 0.7rem 1rem; border-radius: 12px; font-size: 0.93rem; }
.bubble.user { background: var(--marino); color: #fff; margin-left: auto; width: fit-content; border-bottom-right-radius: 4px; }
.bubble.bot { background: var(--superficie); border: 1px solid var(--borde); border-bottom-left-radius: 4px; }
.bubble.bot.error, .error-text { background: #f9eae9; color: #7e2d27; border-color: #ecc8c5; }
.bubble.wait { color: var(--gris); font-style: italic; }
.bubble tbody tr:hover { cursor: default; }
.bubble details { margin: 0.5rem 0; }
.bubble details summary { cursor: pointer; color: var(--marino); font-size: 0.85rem; font-weight: 600; }
.bubble pre {
  background: var(--tinta);
  color: #d5deee;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  margin-top: 0.4rem;
}
.bubble .table-wrap { max-height: 340px; overflow-y: auto; box-shadow: none; border: 1px solid var(--borde); margin-top: 0.5rem; }
.csv-btn { margin-top: 0.6rem; }
#chat-form { display: flex; gap: 0.6rem; }
#chat-input { flex: 1; }

/* --- Página de acceso --- */

body.acceso {
  background:
    linear-gradient(160deg, rgba(14, 19, 23, 0.82) 0%, rgba(33, 53, 89, 0.78) 55%, rgba(3, 25, 85, 0.72) 100%),
    url("/marca/fondo-barco.jpg") center / cover no-repeat fixed;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.panel-acceso { width: 100%; max-width: 400px; }
.panel-acceso .logo-grande { display: block; height: 96px; width: 96px; margin: 0 auto 1.2rem; }
.panel-acceso .lema {
  text-align: center;
  color: #d5deee;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 1.6rem;
}
.panel-acceso .tarjeta { padding: 2rem; }
.panel-acceso h2 { font-size: 1.15rem; }
.panel-acceso label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--tinta);
  margin: 1.1rem 0 0.35rem;
}
.panel-acceso input { width: 100%; }
.panel-acceso .boton { width: 100%; margin-top: 1.3rem; }
.panel-acceso .pie {
  text-align: center;
  color: #93a3c0;
  font-size: 0.78rem;
  margin-top: 1.4rem;
}

/* --- Pie de página --- */

footer.pie-portal {
  text-align: center;
  color: var(--gris);
  font-size: 0.8rem;
  padding: 0 1rem 2rem;
}

@media (max-width: 640px) {
  main { margin-top: 1.5rem; }
  .tarjeta { padding: 1.25rem; }
  header.barra { padding: 0.7rem 1rem; }
  .marca-cabecera .subtitulo { display: none; }
}
