:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-darker: #1e3a8a;
  --color-primary-soft: #eff6ff;
  --color-primary-soft-hover: #dbeafe;
  --color-primary-border-hover: #93c5fd;

  --color-body-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-muted: #f1f5f9;
  --color-surface-border: #e2e8f0;
  --color-surface-border-light: #cbd5e1;

  --color-heading: #0f172a;
  --color-title: #1e293b;
  --color-body: #475569;
  --color-body-muted: #64748b;
  --color-placeholder: #94a3b8;
  --color-icon-muted: #cbd5e1;

  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 10px 25px -5px rgba(15, 23, 42, 0.1);

  --status-default-border: #bfdbfe;
  --status-default-bg: #eff6ff;
  --status-default-text: #1e40af;
  --status-revision-border: #fde68a;
  --status-revision-bg: #fef9c3;
  --status-revision-text: #854d0e;
  --status-published-border: #bbf7d0;
  --status-published-bg: #dcfce7;
  --status-published-text: #166534;

  --color-hero-gradient-end: var(--color-primary-darker);
  --color-home-result-category-bg: #f3e8ff;
  --color-home-result-category-border: #e9d5ff;
  --color-home-result-category-text: #7e22ce;
  --color-home-result-disease-bg: var(--color-primary-soft);
  --color-home-result-disease-text: var(--color-primary-dark);
}

.bold{ font-weight: bold;}
.bold.bi::before{
  font-weight: 600!important;
}
.text-primary-darker { color: var(--color-primary-darker); }
.text-primary-dark { color: var(--color-primary-dark); }

/* Layout shell (base.html) */
.site-brand-link.site-brand-link--active .site-brand-title {
  color: var(--color-primary-dark);
}
.site-header-logo {
  height: 46px;
  width: auto;
  object-fit: contain;
}
.site-nav {
  gap: 0;
}
.site-nav-link {
  color: var(--color-body-muted);
  font-weight: 700;
  text-decoration: none;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-nav-link:hover {
  color: var(--color-body);
  text-decoration: none;
}
.site-nav-link--active {
  color: var(--color-primary-dark);
}
.site-nav-link:focus {
  outline: none;
  text-decoration: none;
}
.site-nav-link:focus-visible {
  color: var(--color-primary-dark);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
  border-radius: 0.15rem;
}
.site-brand-title {
  line-height: 1;
}
.site-brand-tagline {
  letter-spacing: 0.08em;
}

/* Header — invitado / usuario (hidden nativo + flex cuando visible) */
.auth-header-guest[hidden],
.auth-header-user[hidden] {
  display: none !important;
}
.auth-header-user:not([hidden]) {
  display: flex;
}

/* Header — usuario autenticado (demo sessionStorage, estilo Canvas) */
.auth-header-user-text {
  line-height: 1.25;
}
.auth-header-logout {
  color: #dc2626 !important;
  font-size: 0.75rem;
  font-weight: 600;
}
.auth-header-logout:hover {
  color: #b91c1c !important;
  text-decoration: underline !important;
}
.auth-header-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--color-primary-soft);
  color: var(--color-primary-darker);
  border: 2px solid var(--color-surface);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Modal de login / registro (Gemini Canvas) */
body.auth-modal-open {
  overflow: hidden;
}
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: none;
  align-items: flex-start;
  justify-content: center;
  min-height: 100%;
  min-height: 100dvh;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  animation: authModalFade 0.25s ease-out;
}
.auth-modal.is-open {
  display: flex;
}
@keyframes authModalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.auth-modal-backdrop {
  /* Fixed to the viewport so it does not scroll with the tall dialog */
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(15, 23, 42, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.auth-modal-dialog {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 100%;
  max-width: 28rem;
  margin: auto 0;
  background: var(--color-surface);
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  /* Clip children (brand strip, etc.) to border-radius; scroll stays on .auth-modal */
  overflow: hidden;
  animation: authModalPop 0.25s ease-out;
}
@keyframes authModalPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.auth-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-modal-close:hover {
  background: #f1f5f9;
  color: #475569;
}
.auth-modal-brand {
  padding: 2rem 2rem 1.25rem;
  text-align: center;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}
.auth-modal-logo-wrap {
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.auth-modal-logo {
  max-height: 4rem;
  width: auto;
  object-fit: contain;
}
.auth-modal-brand-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.02em;
}
.auth-modal-brand-sub {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: #64748b;
}
.auth-modal-body {
  padding: 2rem;
}
.auth-modal-heading {
  margin: 0 0 1.5rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
  text-align: center;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.auth-field {
  margin: 0;
}
.auth-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}
.auth-input-wrap {
  position: relative;
}
.auth-input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: #94a3b8;
  pointer-events: none;
}
.auth-input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.5rem;
  font-size: 0.9rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  color: #0f172a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-input::placeholder {
  color: #94a3b8;
}
.auth-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.auth-submit {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: #1d4ed8;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(30, 58, 138, 0.35);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.auth-submit:hover {
  background: #1e40af;
}
.auth-submit:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}
.auth-modal-switch {
  margin-top: 1.5rem;
}
.auth-switch-link {
  padding: 0;
  border: none;
  background: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2563eb;
  cursor: pointer;
  text-decoration: none;
}
.auth-switch-link:hover {
  color: #1e40af;
  text-decoration: underline;
}
.auth-modal-notice {
  display: none;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.5rem;
}
.auth-modal-notice.is-visible {
  display: block;
}

.auth-modal-alert {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  border-radius: 0.5rem;
}
.auth-modal-alert[hidden] {
  display: none !important;
}
.auth-modal-alert--error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}
.auth-field-error {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: #b91c1c;
  line-height: 1.35;
}
.auth-field-error[hidden] {
  display: none !important;
}
.auth-input-wrap--invalid .auth-input {
  border-color: #f87171;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.35);
}
.auth-input-wrap--invalid .auth-input:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}
.auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.home-footnote-auth {
  font-size: inherit;
  font-weight: 600;
  color: var(--color-primary-dark);
  text-decoration: underline;
  vertical-align: baseline;
}
.home-footnote-auth:hover {
  color: var(--color-primary-darker);
}

.auth-login-page-wrap .auth-login-page-card {
  max-width: 28rem;
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.site-footer {
  background: var(--color-heading);
  color: var(--color-placeholder);
  border-top: 1px solid var(--color-title);
}
.site-footer a {
  color: var(--color-placeholder);
}
.site-footer a:hover {
  color: var(--color-surface);
}
.areas-body { background: var(--color-body-bg); }
  .areas-wrap {
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    padding: 3rem 1rem;
    animation: areasFadeIn 0.35s ease-out;
  }
  @keyframes areasFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .areas-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-surface-border);
  }
  .areas-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 0.5rem;
  }
  .areas-header p {
    color: var(--color-body);
    margin: 0;
  }
  .areas-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  @media (min-width: 768px) {
    .areas-grid { grid-template-columns: repeat(2, 1fr); }
  }
  @media (min-width: 1024px) {
    .areas-grid { grid-template-columns: repeat(3, 1fr); }
  }
  .area-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--color-surface-border);
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    text-decoration: none;
    color: inherit;
  }
  .area-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--color-primary-border-hover);
    text-decoration: none;
    color: inherit;
    transform: translateY(-2px);
  }
  .area-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
  }
  .area-card-icon-wrap {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: var(--color-primary-soft);
    transition: background 0.3s ease, color 0.3s ease;
    overflow: hidden;
  }
  .area-card:hover .area-card-icon-wrap {
    background: var(--color-primary);
    color: var(--color-surface);
  }
  .area-card-icon-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .area-card-icon-wrap i {
    font-size: 1.75rem;
    color: var(--color-primary-dark);
    transition: color 0.3s ease;
  }
  .area-card:hover .area-card-icon-wrap i {
    color: var(--color-surface);
  }
  .area-card-chevron {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: var(--color-body-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
  }
  .area-card:hover .area-card-chevron {
    background: var(--color-primary-soft-hover);
    color: var(--color-primary);
  }
  .area-card-chevron i {
    font-size: 0.85rem;
    color: var(--color-icon-muted);
  }
  .area-card:hover .area-card-chevron i {
    color: var(--color-primary);
  }
  .area-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-title);
    margin-bottom: 0.5rem;
    transition: color 0.2s ease;
  }
  .area-card:hover h3 {
    color: var(--color-primary-dark);
  }
  .area-card-desc {
    color: var(--color-body-muted);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1;
  }
  .area-card-cta {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: auto;
  }
  .areas-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-body-muted);
    background: var(--color-surface);
    border: 1px dashed var(--color-surface-border-light);
    border-radius: 0.75rem;
  }

  .areas-body { background: var(--color-body-bg); }
  .category-wrap { max-width: 80rem; margin: 0 auto; padding: 2rem 1rem 3rem; }
  .category-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--color-body-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
  }
  .category-back:hover { color: var(--color-primary); text-decoration: none; }
  .category-head h1 { font-size: 1.875rem; font-weight: 700; color: var(--color-heading); }
  .category-head p { color: var(--color-body); max-width: 42rem; margin-top: 0.5rem; }
  .disease-panel {
    background: var(--color-surface);
    border-radius: 0.75rem;
    border: 1px solid var(--color-surface-border);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    margin-top: 1.5rem;
  }
  .disease-panel-head {
    padding: 1rem 1.25rem;
    background: var(--color-body-bg);
    border-bottom: 1px solid var(--color-surface-muted);
    font-size: 0.875rem;
    color: var(--color-body-muted);
  }
  .disease-panel-toolbar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  @media (min-width: 576px) {
    .disease-panel-toolbar {
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
    }
  }
  .disease-panel-toolbar-left {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
  }
  .disease-panel-toolbar-left .bi-filter {
    flex-shrink: 0;
    color: var(--color-icon-muted);
    font-size: 1rem;
  }
  .disease-panel-toolbar-label {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--color-body-muted);
    font-size: 0.875rem;
    white-space: nowrap;
  }
  .disease-panel-sort {
    min-width: 0;
    flex: 1 1 12rem;
    max-width: 100%;
    border-color: #cbd5e1;
    font-size: 0.875rem;
    color: var(--color-title);
    background: var(--color-surface);
  }
  .disease-panel-sort:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.15rem rgba(37, 99, 235, 0.2);
  }
  .disease-panel-toolbar-right {
    font-size: 0.875rem;
  }
  .disease-row {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
  }
  .disease-row:last-child { border-bottom: 0; }
  .disease-row:hover { background: rgba(239, 246, 255, 0.5); text-decoration: none; color: inherit; }
  .disease-row h3 { font-size: 1.125rem; font-weight: 700; color: var(--color-title); margin: 0 0 0.35rem 0; }
  .disease-row p { font-size: 0.875rem; color: var(--color-body-muted); margin: 0; }
  .disease-row .fa-chevron-right {
    color: var(--color-icon-muted);
  }
  .disease-row .fa-chevron-right {
    color: var(--color-icon-muted);
  }
  .disease-row .disease-info{
    font-size: 0.8rem;
    color: var(--color-placeholder);
  }

  .badge-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    border: 1px solid var(--status-default-border);
    background: var(--status-default-bg);
    color: var(--status-default-text);
  }
  .badge-status.revision { border-color: var(--status-revision-border); background: var(--status-revision-bg); color: var(--status-revision-text); }
  .badge-status.publicado { border-color: var(--status-published-border); background: var(--status-published-bg); color: var(--status-published-text); }
  .badge-status.no_publicado { border-color: var(--color-surface-border); background: var(--color-surface-muted); color: var(--color-body); }
  .areas-empty-inner { padding: 2.5rem; text-align: center; color: var(--color-placeholder); }

/* Home (HomeView) */
.home-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 60vh;
  animation: areasFadeIn 0.35s ease-out;
}
.home-hero {
  width: 100%;
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 5rem 1rem;
  color: var(--color-surface);
  border-radius: 0 0 3rem 3rem;
  box-shadow: var(--shadow-hover);
  background: linear-gradient(
    90deg,
    var(--color-heading) 0%,
    var(--color-hero-gradient-end) 100%
  );
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.1;
  background-image: url("https://www.transparenttextures.com/patterns/medical-icons.png");
  pointer-events: none;
}
.home-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}
.home-hero-title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}
@media (min-width: 768px) {
  .home-hero-title {
    font-size: 3rem;
  }
}
.home-hero-lead {
  color: var(--color-primary-soft-hover);
  font-size: 1.25rem;
  font-weight: 300;
  margin-bottom: 2.5rem;
}
.home-hero-lead strong {
  font-weight: 600;
  color: var(--color-surface);
}
.home-search-wrap {
  position: relative;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 2rem;
}
.home-search-input {
  width: 100%;
  padding: 1.1rem 1rem 1.1rem 3rem;
  border-radius: 1rem;
  border: none;
  box-shadow: var(--shadow-hover);
  font-size: 1.05rem;
  color: var(--color-title);
  background: var(--color-surface);
}
.home-search-input::placeholder {
  color: var(--color-placeholder);
}
.home-search-input:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25), var(--shadow-hover);
}
.home-search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-placeholder);
  pointer-events: none;
}
.home-search-results {
  display: none;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1rem;
  background: var(--color-surface);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-hover);
  text-align: left;
  color: var(--color-title);
  overflow: hidden;
}
.home-search-results.is-visible {
  display: block;
}
.home-search-results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-surface-border);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-body-muted);
}
.home-search-results-head span:last-child {
  font-weight: 400;
  color: var(--color-primary);
}
.home-search-results-body {
  max-height: 400px;
  overflow-y: auto;
}
.home-search-empty {
  padding: 2rem;
  text-align: center;
  color: var(--color-body-muted);
}
.home-search-empty i {
  font-size: 2rem;
  color: var(--color-surface-border-light);
  margin-bottom: 0.5rem;
  display: block;
}
.home-result-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--color-surface-muted);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
.home-result-row:last-child {
  border-bottom: none;
}
.home-result-row:hover {
  background: var(--color-primary-soft);
  text-decoration: none;
  color: inherit;
}
.home-result-icon-wrap {
  flex-shrink: 0;
  margin-top: 0.15rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
}
.home-result--category .home-result-icon-wrap {
  background: var(--color-home-result-category-bg);
  color: var(--color-home-result-category-text);
}
.home-result--disease .home-result-icon-wrap {
  background: var(--color-home-result-disease-bg);
  color: var(--color-home-result-disease-text);
}
.home-result-middle {
  flex: 1;
  min-width: 0;
}
.home-result-title {
  font-weight: 700;
  color: var(--color-title);
  margin-bottom: 0.15rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.home-result-chip {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  border: 1px solid var(--color-surface-border);
}
.home-result--category .home-result-chip {
  background: var(--color-home-result-category-bg);
  color: var(--color-home-result-category-text);
  border-color: var(--color-home-result-category-border);
}
.home-result--disease .home-result-chip {
  background: var(--color-home-result-disease-bg);
  color: var(--color-home-result-disease-text);
  border-color: var(--color-primary-border-hover);
}
.home-result-desc {
  font-size: 0.875rem;
  color: var(--color-body-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-result-chevron {
  flex-shrink: 0;
  align-self: center;
  color: var(--color-surface-border-light);
}
.home-result-row:hover .home-result-chevron {
  color: var(--color-primary);
}
.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.btn-link{
  color: var(--color-primary);
}
.btn-mafe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.2;
  padding: 0.65rem 1.5rem;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.btn-mafe:hover,
.btn-mafe:focus {
  text-decoration: none;
}
.btn-mafe:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.35);
}
.btn-mafe-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-surface);
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.45);
}
.btn-mafe-primary:hover,
.btn-mafe-primary:focus {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-surface);
}
.btn-mafe-secondary {
  width: 100%;
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.btn-mafe-secondary:hover,
.btn-mafe-secondary:focus {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #334155;
}
.btn-mafe-tertiary {
  background: #1f2937;
  border-color: #1f2937;
  color: var(--color-surface);
  padding: 0.42rem 0.9rem;
  border-radius: 0.55rem;
  font-size: 0.82rem;
}
.btn-mafe-tertiary:hover,
.btn-mafe-tertiary:focus {
  background: #111827;
  border-color: #111827;
  color: var(--color-surface);
}
.home-btn-areas {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-surface);
  padding: 0.65rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s ease;
}
.home-btn-areas:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-surface);
  text-decoration: none;
}
.home-btn-library {
  transition: background-color 0.2s ease;
}
.home-btn-library:hover {
  text-decoration: none;
}
.btn-login{
  font-size: 0.9rem;
}
.home-footnote {
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  padding: 3rem 1rem;
  font-size: 0.875rem;
  color: var(--color-placeholder);
}

/* Biblioteca — Canvas LibraryView + BookDetailModal */
.library-canvas {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  padding: 3rem 1rem;
  animation: areasFadeIn 0.35s ease-out;
}
@media (min-width: 640px) {
  .library-canvas {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .library-canvas {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}
.library-canvas-inner {
  position: relative;
}
.library-canvas-head {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}
.library-canvas-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.5rem;
}
.library-canvas-sub {
  margin: 0;
  color: #475569;
  font-size: 1rem;
}
.library-canvas-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 768px) {
  .library-canvas-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .library-canvas-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.library-book-card {
  background: #fff;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease;
}
.library-book-card:hover {
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
}
.library-book-cover-wrap {
  position: relative;
  height: 16rem;
  overflow: hidden;
  background: #f1f5f9;
}
.library-book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.library-book-card:hover .library-book-cover-img {
  transform: scale(1.05);
}
.library-book-cover-shade {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.2s ease;
  pointer-events: none;
}
.library-book-card:hover .library-book-cover-shade {
  background: rgba(0, 0, 0, 0.05);
}
.library-book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
}
.library-book-cover-placeholder-text {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.library-book-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.library-book-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  margin: 0 0 0.25rem 0;
}
.library-book-edition {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0 0 0.25rem 0;
}
.library-book-author {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0 0 1rem 0;
}
.library-book-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.library-btn-ficha {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.library-btn-ficha:hover {
  background: var(--color-body-bg);
  border-color: #cbd5e1;
  color: var(--color-title);
}
.library-btn-ficha:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.libro-book-modal .modal-dialog {
  max-width: 32rem;
}
@media (min-width: 768px) {
  .libro-book-modal .modal-dialog.libro-book-modal-dialog {
    max-width: 32rem;
  }
}
.libro-book-modal-content {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
}
.libro-book-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 5;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--color-title);
  border: none;
  line-height: 1;
  font-size: 1.5rem;
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.libro-book-modal-close:hover {
  background: #fff;
  color: #0f172a;
}
.libro-book-modal-layout {
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) {
  .libro-book-modal-layout {
    flex-direction: row;
    align-items: stretch;
    min-height: 280px;
  }
}
.libro-book-modal-cover-col {
  flex: 0 0 auto;
  width: 100%;
  min-height: 200px;
  background: #f1f5f9;
  position: relative;
}
@media (min-width: 768px) {
  .libro-book-modal-cover-col {
    width: 33.333%;
    min-height: 100%;
  }
}
.libro-book-modal-cover-img {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: cover;
  display: block;
}
@media (min-width: 768px) {
  .libro-book-modal-cover-img {
    min-height: 280px;
  }
}
.libro-book-modal-placeholder {
  width: 100%;
  min-height: 200px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
}
@media (min-width: 768px) {
  .libro-book-modal-placeholder {
    min-height: 280px;
  }
}
.libro-book-modal-placeholder-text {
  font-size: 1.125rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  line-height: 1.3;
}
.libro-book-modal-main {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.libro-book-modal-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
  line-height: 1.2;
  padding-right: 2.5rem;
}
.libro-book-modal-sub {
  font-size: 0.95rem;
}
.libro-book-modal-summary {
  white-space: pre-line;
}
.libro-modal-pdf-btn {
  border-radius: 0.75rem;
}

/* Articulo detail (DiseaseView-inspired) */
.article-wrap {
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  animation: areasFadeIn 0.35s ease-out;
}
.article-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.875rem;
  color: var(--color-body-muted);
  margin-bottom: 1.25rem;
  gap: 0.5rem;
}
.article-breadcrumb a {
  color: var(--color-body-muted);
  text-decoration: none;
}
.article-breadcrumb a:hover {
  color: var(--color-primary);
  text-decoration: none;
}
.article-breadcrumb .bc-sep {
  color: var(--color-icon-muted);
}
.article-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 992px) {
  .article-grid {
    grid-template-columns: 3fr 1fr;
    gap: 2rem;
  }
}
.article-card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-soft);
}
.article-card-pad {
  padding: 1.75rem;
}
.article-top-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.article-id-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-surface-border);
  color: var(--color-body-muted);
}
.article-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-heading);
  margin: 0 0 1rem 0;
  letter-spacing: -0.02em;
}
@media (min-width: 768px) {
  .article-title {
    font-size: 2.4rem;
  }
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-surface-muted);
  font-size: 0.875rem;
  color: var(--color-body-muted);
}
.article-meta .meta-right {
  margin-left: auto;
}
.article-meta strong {
  color: var(--color-title);
  font-weight: 600;
}
.article-meta .meta-item i {
  color: var(--color-primary);
  margin-right: 0.35rem;
}
.article-content {
  margin-top: 1.5rem;
}
.article-section {
  padding: 1.75rem;
  border-top: 1px solid var(--color-surface-muted);
}
.article-section:first-child {
  border-top: none;
}
.article-section h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-primary-darker);
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-primary-soft-hover);
}
.article-section p {
  color: var(--color-title);
  line-height: 1.7;
  margin: 0;
}
.article-section .article-muted {
  color: var(--color-body-muted);
}
.article-callout {
  margin-top: 0.75rem;
  background: var(--color-surface-muted);
  border-left: 4px solid var(--color-primary);
  border-radius: 0.5rem;
  padding: 1rem;
  color: var(--color-title);
  white-space: pre-line;
}
.article-note {
  background: #fefce8;
  border: 1px solid #fef9c3;
  border-radius: 0.5rem;
  padding: 1rem;
  color: #854d0e;
  font-style: italic;
}

.article-refs-card {
  margin-top: 1.5rem;
  overflow: hidden;
}
.article-refs-inner {
  padding: 1.5rem; /* p-6 */
}
.article-refs-heading {
  font-size: 1.125rem; /* text-lg */
  font-weight: 700;
  color: #1e293b; /* slate-800 */
  margin: 0 0 1rem 0; /* mb-4 */
  letter-spacing: -0.01em;
}
.article-refs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem; /* space-y-4 */
}
.article-refs-item {
  display: flex;
  gap: 0.75rem; /* gap-3 */
  font-size: 0.875rem; /* text-sm */
  line-height: 1.5;
  color: #475569; /* slate-600 */
  border-bottom: 1px solid #f8fafc; /* border-slate-50 */
  padding-bottom: 0.75rem; /* pb-3 */
  margin: 0;
  border-radius: 0.25rem;
  transition: background-color 0.15s ease;
}
.article-refs-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.article-refs-index {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  color: #94a3b8; /* slate-400 */
  flex-shrink: 0;
  line-height: 1.5;
  min-width: 2rem;
}
.article-refs-body {
  flex: 1;
  min-width: 0;
}
.article-refs-title-line {
  font-weight: 500; /* font-medium */
  color: #1e293b; /* slate-800 */
  margin: 0;
  line-height: 1.5;
}
.article-refs-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem; /* gap-2 */
  font-size: 0.75rem; /* text-xs */
  margin-top: 0.25rem; /* mt-1 */
  margin-bottom: 0.5rem; /* mb-2 */
}
.article-refs-meta > * {
  flex-shrink: 0;
}
.article-refs-year {
  color: #475569;
}
.article-refs-source {
  color: #64748b; /* slate-500 — rol tipo ref.source en Canvas */
}
.article-refs-doi {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
.article-refs-doi:hover {
  text-decoration: underline;
  color: #1d4ed8;
}
.article-refs-doi-text {
  display: inline;
}
.article-refs-ext {
  font-size: 0.7rem;
  line-height: 1;
  opacity: 0.9;
  flex-shrink: 0;
}
.article-refs-pdf {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem; /* gap-2 */
  margin-top: 0;
  font-size: 0.75rem; /* text-xs */
  color: #b91c1c; /* red-700 */
  background: #fef2f2; /* red-50 */
  border: 1px solid #fee2e2; /* red-100 */
  border-radius: 0.375rem; /* rounded-md */
  padding: 0.375rem 0.75rem; /* py-1.5 px-3 */
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.article-refs-pdf:hover {
  background: #fee2e2; /* red-100 */
  border-color: #fecaca;
  color: #991b1b;
  text-decoration: none;
}
.article-refs-pdf-icon {
  font-size: 0.875rem;
  opacity: 0.95;
}

.article-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.article-sidebar-card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-soft);
  padding: 1.25rem;
}
.article-sidebar-card h3 {
  font-size: 1rem;
  font-weight: 800;
  margin: 0 0 0.75rem 0;
  color: var(--color-title);
}
.article-sidebar-card h4 {
  font-size: 0.85rem;
  font-weight: 800;
  margin: 0 0 0.75rem 0;
  color: var(--color-title);
}
.tag-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  border: 1px solid var(--color-primary-border-hover);
  border-radius: 9999px;
  padding: 0.2rem 0.55rem;
  margin: 0 0.35rem 0.35rem 0;
}