:root {
  /* Colores institucionales CSIF */
  --csif-green: #00966B;
  --csif-green-dark: #007a57;
  --csif-mint: #E7F6F1;
  --csif-isla: #28B078;
  --csif-bg: #F5F7FA;
  --text: #0B0F14;
  --muted: #5B6675;
  --border: #D7E3EA;
  --danger: #a32d2d;
  --danger-light: #fcebeb;
  --success: #007a57;
  --success-light: #E7F6F1;

  --radius-lg: 16px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow: 0 10px 30px rgba(11, 15, 20, .06);
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, sans-serif;
  color: var(--text);
  margin: 0;
  line-height: 1.6;
  background: var(--csif-bg);
}

/* ---------------------------------------------------------------- header */
.site-header {
  background: linear-gradient(90deg, var(--csif-green), #19b18a);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-block;
  padding: 16px 24px;
  font-weight: 900;
  letter-spacing: .2px;
  color: #fff;
  text-decoration: none;
  font-size: 17px;
}

/* --------------------------------------------------------------- poster */
.poster-img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 8px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px;
}

h1 { font-size: 26px; margin-bottom: 4px; letter-spacing: -.2px; }
.lead { color: var(--muted); margin-top: 0; font-weight: 500; }

.breadcrumb { font-size: 14px; margin-bottom: 8px; }
.breadcrumb a { color: var(--csif-green-dark); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- hero/map */
.hero-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-top: 20px;
}

.mapa-wrap {
  margin-top: 12px;
}

.mapa-svg {
  width: 100%;
  height: auto;
  display: block;
}

.isla {
  fill: var(--csif-isla);
  stroke: #ffffff !important;
  cursor: pointer;
  transition: fill .15s;
}

.isla:hover,
.isla:focus {
  fill: var(--csif-green);
  outline: none;
}

.isla:focus-visible {
  stroke: var(--csif-green-dark) !important;
  stroke-width: 3 !important;
}

.mapa-hint {
  font-weight: 700;
  color: var(--csif-green-dark);
  min-height: 20px;
  margin: 8px 0 0;
}

/* -------------------------------------------------------- choice grids */
.cuerpo-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.cuerpo-card {
  display: block;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  transition: border-color .15s, background .15s, transform .1s;
}
.cuerpo-card:hover {
  border-color: var(--csif-green);
  background: var(--csif-mint);
}
.cuerpo-card:active { transform: scale(.98); }

.cuerpo-card.cuerpo-card-match {
  border-color: var(--csif-green);
  background: var(--csif-mint);
  color: var(--csif-green-dark);
}

.cuerpo-card.cuerpo-card-dim {
  opacity: 0.35;
}

/* ---------------------------------------------------- specialty search */
.especialidad-search-wrap {
  margin-top: 20px;
}

.especialidad-search {
  width: 100%;
  max-width: 420px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
}

.especialidad-search:focus {
  outline: none;
  border-color: var(--csif-green);
  box-shadow: 0 0 0 3px var(--csif-mint);
}

.especialidad-search-hint {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  min-height: 18px;
  margin: 8px 0 0;
}

/* --------------------------------------------------------------- cards */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin: 24px 0;
  overflow: hidden;
}

.card-h {
  padding: 14px 20px;
  background: linear-gradient(90deg, var(--csif-mint), #fff);
  border-bottom: 1px solid var(--border);
  font-weight: 900;
  color: var(--csif-green-dark);
  font-size: 15px;
}

.card-b {
  padding: 20px;
}

/* -------------------------------------------------------------- forms */
form label {
  display: block;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
}

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--csif-green);
  box-shadow: 0 0 0 3px var(--csif-mint);
}

button {
  background: var(--csif-green);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
button:hover { background: var(--csif-green-dark); }

/* ----------------------------------------------------------------- kpi */
.kpi {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}
.kpi .box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 14px;
}
.kpi .num {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -.2px;
  color: var(--csif-green-dark);
  margin-bottom: 2px;
}
.kpi .lbl {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* --------------------------------------------------------- entry cards */
.entry-list { list-style: none; padding: 0; }

.entry-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--csif-green);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.entry-card > details > summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.entry-card > details > summary::-webkit-details-marker {
  display: none;
}
.entry-card > details > summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  color: var(--csif-green);
}
.entry-card > details[open] > summary::before {
  content: "▾";
}

.node-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.reply-message {
  white-space: pre-line;
}

details summary {
  cursor: pointer;
}

.nested-replies {
  margin: 10px 0;
}
.nested-replies > summary {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  list-style: none;
}
.nested-replies > summary::-webkit-details-marker {
  display: none;
}
.nested-replies > summary::before {
  content: "▸ ";
}
.nested-replies[open] > summary::before {
  content: "▾ ";
}

.children-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0 0 0 16px;
}

.children-list > li {
  margin-bottom: 10px;
}

/* Cada respuesta es su propia tarjeta, con un color de acento distinto
   según el nivel de anidación, para que no se confundan unas con otras
   sobre fondo blanco. */
.reply-level-1,
.reply-level-2,
.reply-flat {
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.reply-level-1 {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--csif-green);
  box-shadow: var(--shadow);
}

.reply-level-2 {
  background: var(--csif-bg);
  border: 1px solid var(--border);
  border-left: 3px solid #6fb8a8;
}

.reply-flat {
  background: var(--csif-mint);
  border: 1px solid #c9efe2;
  border-left: 3px solid var(--muted);
}


/* ---------------------------------------------------- responder toggle */
.reply-toggle {
  margin: 10px 0;
}
.reply-toggle-summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--csif-green-dark);
  background: var(--csif-mint);
  border: 1px solid #c9efe2;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  list-style: none;
  cursor: pointer;
}
.reply-toggle-summary::-webkit-details-marker {
  display: none;
}
.reply-toggle[open] > .reply-toggle-summary {
  background: var(--csif-green);
  color: #fff;
  border-color: var(--csif-green);
}

.reply-form {
  margin: 10px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--csif-bg);
  max-width: 480px;
}
.reply-form label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}
.reply-form textarea, .reply-form input {
  margin-top: 4px;
}

/* ------------------------------------------------------------- flashes */
.meta { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }
.rights-note {
  font-size: 13px;
  color: var(--muted);
  background: var(--csif-bg, #F5F7FA);
  border-left: 3px solid var(--csif-green, #2E7D32);
  padding: 8px 12px;
  border-radius: 4px;
  margin: 4px 0 18px;
}
.rights-note a { color: var(--csif-green-dark, #1B5E20); font-weight: 600; }

.flashes { list-style: none; padding: 0; margin: 20px 0; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  border-left: 5px solid transparent;
}
.flash-success {
  background: var(--success-light);
  color: var(--success);
  border-left-color: var(--csif-green);
}
.flash-error {
  background: var(--danger-light);
  color: var(--danger);
  border-left-color: var(--danger);
}

/* --------------------------------------------------- aviso de datos */
dialog.consent-dialog {
  border: none;
  padding: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 420px;
  width: 100%;
  overflow: hidden;
}
dialog.consent-dialog::backdrop {
  background: rgba(11, 15, 20, .45);
}
.consent-dialog .consent-h {
  padding: 14px 20px;
  background: linear-gradient(90deg, var(--csif-mint), #fff);
  border-bottom: 1px solid var(--border);
  font-weight: 900;
  color: var(--csif-green-dark);
  font-size: 15px;
}
.consent-body {
  padding: 20px;
}
.consent-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 12px;
}
.consent-text a {
  color: var(--csif-green-dark);
}
.consent-facts {
  list-style: none;
  margin: 0 0 14px;
  padding: 12px 14px;
  background: var(--csif-bg);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}
.consent-facts li {
  margin-bottom: 6px;
}
.consent-facts li:last-child {
  margin-bottom: 0;
}
.consent-facts strong {
  color: var(--text);
}
.consent-facts a {
  color: var(--csif-green-dark);
}
.consent-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin: 4px 0 18px;
}
.consent-check input {
  display: inline-block;
  width: auto;
  margin: 2px 0 0;
}
.consent-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.consent-actions .consent-cancel {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--border);
}
.consent-actions .consent-cancel:hover {
  background: var(--csif-bg);
}

/* -------------------------------------------------------------- footer */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 28px 24px;
}
.footer-links {
  margin-top: 8px;
}
.footer-links a {
  color: var(--muted);
  text-decoration: underline;
}
.footer-links a:hover {
  color: var(--csif-green-dark);
}

/* -------------------------------------------------------------- páginas legales */
.legal-section {
  margin-bottom: 28px;
}
.legal-section h2 {
  font-size: 17px;
  margin-bottom: 8px;
}
.legal-section p,
.legal-section li {
  color: var(--muted);
  font-size: 14.5px;
}
.legal-section ul {
  padding-left: 20px;
}
.legal-section li {
  margin-bottom: 4px;
}
.cookie-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13.5px;
}
.cookie-table th,
.cookie-table td {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.cookie-table th {
  background: var(--csif-bg);
  color: var(--text);
}
.cookie-table td {
  color: var(--muted);
}

@media (max-width: 480px) {
  .container { padding: 24px 16px; }
  h1 { font-size: 22px; }
}