@layer theme {
/* =========================================================
   GestFel · Capa visual dinámica de instancia
   ---------------------------------------------------------
   Se carga al final. Contiene ajustes de marca, layout
   privado y módulos específicos de instancia.
   Los tokens se compilan desde settings.php.
   No editar CSS en ficheros PHP.
   ========================================================= */

:root {
  --teal: #0b7d6d;
  --brand-primary: #0b7d6d;
  --brand-primary-rgb: 11, 125, 109;
  --brand-secondary: #f4a261;
  --brand-accent: #e76f51;
  --dark: #0f2437;
  --brand-dark: #0f2437;
  --mint: #e6f4f1;
  --brand-soft: #e6f4f1;
  --brand-soft-rgb: 230, 244, 241;
  --brand-primary-deep: #0c645e;
  --brand-primary-soft: #f0f8f6;
  --brand-primary-pale: #f6fbfa;
  --brand-border: #a5cbc4;
  --brand-footer-text: #0f2437;
  --brand-footer-muted: #475569;
  --brand-dark-logo-bg: #d8eae8;
  --brand-dark-logo-border: #b6d8d3;
  --cb-icon-teal: #0b7d6d;
  --cb-soft-teal: #e6f4f1;
}

/* ---------- Council dashboard refresh ---------- */
.council-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.council-dashboard > .dashboard-widget {
  grid-column: 1 / -1;
}

.council-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 1rem;
  align-items: stretch;
  padding: 1.1rem;
  border: 1px solid rgba(var(--brand-primary-rgb), .26);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(var(--brand-soft-rgb), .5));
  box-shadow: 0 16px 44px rgba(15,36,55,.08);
}

.council-hero-copy {
  min-width: 0;
}

.council-eyebrow {
  display: inline-flex;
  margin-bottom: .42rem;
  color: var(--muted);
  font-weight: 800;
  font-size: .88rem;
}

.council-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3.1vw, 3rem);
  line-height: 1;
}

.council-hero p {
  max-width: 760px;
  margin: .55rem 0 0;
  color: var(--muted);
  font-weight: 750;
}

.council-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .7rem;
  align-items: center;
  justify-content: end;
}

.council-identity img,
.council-logo-placeholder {
  width: 112px;
  height: 86px;
  object-fit: contain;
  border: 1px solid rgba(var(--brand-primary-rgb), .18);
  border-radius: 16px;
  background: #fff;
  padding: .55rem;
  box-shadow: 0 14px 30px rgba(15,36,55,.08);
}

.council-logo-placeholder {
  display: grid;
  place-items: center;
  color: var(--brand-primary);
  font-weight: 900;
  font-size: .72rem;
  text-align: center;
}

.council-logo-placeholder .app-icon {
  width: 30px;
  height: 30px;
}

.council-date {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: .38rem;
  color: var(--dark);
  font-weight: 900;
}

.council-date .app-icon,
.council-actions .app-icon,
.council-card-link .app-icon {
  width: 18px;
  height: 18px;
}

.council-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}

.council-actions .btn {
  min-height: 42px;
}

.council-secure-note {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .65rem .85rem;
  border: 1px solid rgba(var(--brand-primary-rgb), .28);
  border-radius: 14px;
  background: rgba(var(--brand-soft-rgb), .62);
  color: var(--brand-primary);
  font-weight: 900;
}

.council-secure-note .app-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

.council-main-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
}

.council-kpi-main {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: .85rem;
  align-items: center;
  min-height: 118px;
  padding: .95rem;
  border: 1px solid #dfe9e6;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(15,36,55,.06);
}

.council-kpi-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(var(--brand-primary-rgb), .12);
  color: var(--brand-primary);
}

.council-kpi-icon .app-icon {
  width: 29px;
  height: 29px;
}

.council-kpi-main span:not(.council-kpi-icon) {
  display: block;
  color: var(--dark);
  font-weight: 850;
}

.council-kpi-main strong {
  display: block;
  margin: .1rem 0;
  color: var(--dark);
  font-size: 2rem;
  line-height: 1;
}

.council-kpi-main small {
  color: var(--muted);
  font-weight: 750;
}

.council-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .65rem;
}

.council-kpi-strip article {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-areas: "icon value" "icon label";
  gap: .1rem .48rem;
  align-items: center;
  min-height: 66px;
  padding: .58rem .68rem;
  border: 1px solid rgba(var(--brand-primary-rgb), .22);
  border-radius: 14px;
  background: rgba(255,255,255,.86);
}

.council-kpi-strip .app-icon {
  grid-area: icon;
  width: 26px;
  height: 26px;
  color: var(--brand-primary);
}

.council-kpi-strip strong {
  grid-area: value;
  color: var(--brand-primary);
  font-size: 1.15rem;
  line-height: 1;
}

.council-kpi-strip span {
  grid-area: label;
  color: var(--muted);
  font-weight: 850;
  font-size: .76rem;
  line-height: 1.1;
}

.council-custom-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: .9rem;
  align-items: stretch;
}

.council-custom-grid .dashboard-widget {
  grid-column: span var(--widget-span, 4);
  min-width: 0;
}

.council-kpi-widget {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.council-widget-titlebar,
.council-card-head.dashboard-widget-titlebar {
  align-items: flex-start;
  padding-bottom: .6rem;
  border-bottom: 1px solid rgba(var(--brand-primary-rgb), .12);
}

.council-kpi-widget .council-widget-titlebar {
  margin-bottom: .65rem;
}

.council-widget-titlebar h2,
.council-card-head .dashboard-widget-heading h2 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 1.08rem;
}

.council-widget-titlebar p,
.council-card-head .dashboard-widget-heading p {
  margin: .12rem 0 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  line-height: 1.2;
}

.council-custom-grid .dashboard-size-controls {
  display: none;
}

.council-custom-grid.is-editing .dashboard-size-controls {
  display: inline-flex;
}

.council-card,
.council-reading {
  padding: 1rem;
  border: 1px solid #dfe9e6;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(15,36,55,.055);
}

.council-card-head {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: .8rem;
}

.council-card-head h2,
.council-reading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.council-card-head span {
  color: var(--muted);
  font-weight: 850;
  font-size: .82rem;
  text-align: right;
}

.council-chart {
  min-height: 245px;
}

.council-side-card,
.council-map-card {
  min-height: 100%;
}

.council-alert-list,
.council-pending-list {
  display: grid;
  gap: .55rem;
}

.council-alert-list a,
.council-pending-list a {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: .2rem .62rem;
  align-items: center;
  padding: .55rem;
  border-radius: 13px;
  color: inherit;
  text-decoration: none;
  background: #fbfdfc;
}

.council-alert-list a:hover,
.council-pending-list a:hover {
  background: rgba(var(--brand-soft-rgb), .72);
}

.council-alert-icon,
.council-pending-list a > span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(var(--brand-primary-rgb), .1);
  color: var(--brand-primary);
}

.council-alert-icon .app-icon,
.council-pending-list .app-icon {
  width: 22px;
  height: 22px;
}

.council-alert-list strong,
.council-pending-list strong {
  min-width: 0;
  line-height: 1.12;
}

.council-alert-list small,
.council-pending-list small {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.18;
}

.council-card-link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .85rem;
  color: var(--brand-primary);
  font-weight: 900;
  text-decoration: none;
}

.council-table-wrap {
  max-height: 430px;
  overflow: auto;
}

.council-table th,
.council-table td {
  white-space: nowrap;
}

.council-table td:first-child,
.council-table th:first-child {
  white-space: normal;
}

.council-map-preview {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid #dfe9e6;
  background:
    linear-gradient(30deg, rgba(11,125,109,.1) 12%, transparent 12% 18%, rgba(244,162,97,.14) 18% 22%, transparent 22%),
    linear-gradient(150deg, transparent 18%, rgba(11,125,109,.08) 18% 24%, transparent 24% 58%, rgba(34,182,166,.12) 58% 64%, transparent 64%),
    #f7fbfa;
}

.council-map-preview::before,
.council-map-preview::after {
  content: "";
  position: absolute;
  inset: 24% -10%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  transform: rotate(-18deg);
  box-shadow: 0 42px 0 rgba(255,255,255,.92), 0 -46px 0 rgba(255,255,255,.86);
}

.council-map-preview::after {
  inset: -10% 40%;
  width: 8px;
  height: auto;
  transform: rotate(28deg);
  box-shadow: 42px 0 0 rgba(255,255,255,.9), -46px 0 0 rgba(255,255,255,.86);
}

.council-map-preview span {
  position: absolute;
  z-index: 1;
  width: 26px;
  height: 26px;
  border: 4px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--brand-primary);
  box-shadow: 0 8px 18px rgba(15,36,55,.18);
  transform: rotate(-45deg);
}

.council-map-preview span:nth-child(1) { left: 12%; top: 22%; }
.council-map-preview span:nth-child(2) { left: 30%; top: 38%; }
.council-map-preview span:nth-child(3) { left: 48%; top: 24%; }
.council-map-preview span:nth-child(4) { left: 66%; top: 42%; }
.council-map-preview span:nth-child(5) { left: 82%; top: 28%; }
.council-map-preview span:nth-child(6) { left: 18%; top: 66%; }
.council-map-preview span:nth-child(7) { left: 42%; top: 72%; }
.council-map-preview span:nth-child(8) { left: 58%; top: 60%; }
.council-map-preview span:nth-child(9) { left: 74%; top: 70%; }

.council-reading {
  display: grid;
  gap: .45rem;
}

.council-reading p {
  margin: 0;
}

@media (max-width: 1180px) {
  .council-main-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .council-kpi-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .council-custom-grid .dashboard-widget {
    grid-column: span min(var(--widget-span, 6), 6);
  }
}

@media (max-width: 780px) {
  .council-hero {
    grid-template-columns: 1fr;
    padding: .9rem;
    border-radius: 18px;
  }

  .council-identity {
    grid-template-columns: 76px minmax(0, 1fr);
    justify-content: stretch;
  }

  .council-identity img,
  .council-logo-placeholder {
    width: 76px;
    height: 62px;
    border-radius: 14px;
  }

  .council-date {
    justify-content: flex-start;
  }

  .council-actions {
    justify-content: stretch;
  }

  .council-actions .btn {
    flex: 1 1 145px;
    justify-content: center;
  }

  .council-main-kpis {
    grid-template-columns: 1fr;
  }

  .council-custom-grid {
    grid-template-columns: 1fr;
  }

  .council-custom-grid .dashboard-widget {
    grid-column: 1 / -1;
  }

  .council-kpi-main {
    min-height: 96px;
  }

  .council-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }

  .council-kpi-strip article {
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-areas: "icon value" "label label";
    min-height: 68px;
  }

  .council-kpi-strip span {
    font-size: .82rem;
  }

  .council-card,
  .council-reading {
    padding: .82rem;
    border-radius: 15px;
  }

  .council-chart {
    min-height: 205px;
  }

  .council-map-preview {
    min-height: 180px;
  }
}

/* ---------- Utilidades de marca ---------- */
.btn-primary,
.button.primary,
a.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.btn-outline,
a.btn-outline {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.brand-theme-preview {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
}

/* ---------- Portada pública y modales ---------- */
.public-nav .btn-primary,
.public-hero .hero-actions .btn-primary,
.public-hero .hero-actions button.btn-primary,
.public-hero button[data-open-modal],
.public-hero [data-open-modal].btn-primary,
button[data-open-modal].btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 18px 34px rgba(15, 36, 55, .12);
}

.public-nav .btn-outline,
.public-hero .hero-actions .btn-outline,
.public-hero a.btn-outline {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  background: #fff;
}

.public-hero h1 span,
.public-preview .preview-sidebar strong,
.public-summary-card-accent strong,
.public-insight-card strong {
  color: var(--brand-primary);
}

.project-info-modal__close,
.project-step-card__badge {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.project-info-modal__close {
  display: inline-grid;
  place-items: center ;
  width: 42px;
  height: 42px;
  padding: 0;
  line-height: 1;
  font-size: 1.55rem;
  font-family: Arial, Helvetica, sans-serif;
  transform: none;
  transition: background-color .18s ease, box-shadow .18s ease;
}

.project-info-modal__close:hover {
  background: var(--brand-primary-deep);
  box-shadow: 0 8px 22px rgba(15, 36, 55, .16);
  transform: none;
}

/* ---------- Formularios específicos ---------- */
.cat-status-fields select {
  border-color: var(--brand-border);
}

.cat-status-fields select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(11, 125, 109, .12);
}

/* =========================================================
   Footers
   ========================================================= */
.site-footer,
.footer,
.app-footer,
.brand-footer {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  border-top: 1px solid var(--brand-border) ;
}

.site-footer {
  display: grid;
  align-items: start;
  gap: clamp(1.5rem, 3vw, 3rem);
}

.site-footer__brand,
.site-footer__block {
  min-width: 0;
}

.site-footer__brand p,
.site-footer__block p {
  margin: .5rem 0 0;
  line-height: 1.55;
}

.site-footer__block a {
  display: block;
  width: fit-content;
  margin-top: .45rem;
  text-decoration: none;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
}

.footer-brand img {
  width: 56px;
  height: 56px;
  max-width: 56px;
  max-height: 56px;
  object-fit: contain;
  opacity: 1;
}

/* Footer público: claro, de marca, legible. */
.public-brand-footer,
.footer.public-brand-footer,
.site-footer.public-brand-footer {
  display: grid;
  grid-template-columns: minmax(280px, 1.35fr) repeat(3, minmax(150px, .7fr));
  padding: clamp(2.25rem, 4vw, 4rem) clamp(1.5rem, 5vw, 5.5rem);
  background:
    radial-gradient(circle at 8% 0%, rgba(255,255,255,.78), transparent 24rem),
    linear-gradient(135deg, var(--brand-primary-soft) 0%, var(--brand-soft) 100%);
  color: var(--brand-dark);
  box-shadow: 0 -12px 36px rgba(15, 36, 55, .06);
}

.public-brand-footer *,
.footer.public-brand-footer *,
.site-footer.public-brand-footer * {
  color: inherit;
}

.public-brand-footer .footer-brand strong,
.footer.public-brand-footer .footer-brand strong {
  color: var(--brand-primary);
  font-size: clamp(1.6rem, 2.2vw, 2.3rem);
  line-height: 1.05;
}

.public-brand-footer .footer-brand img,
.footer.public-brand-footer .footer-brand img {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  padding: .4rem;
  box-shadow: 0 10px 26px rgba(15,36,55,.08);
  filter: none;
}

.public-brand-footer p,
.footer.public-brand-footer p,
.site-footer.public-brand-footer p {
  color: #475569;
}

.public-brand-footer h4,
.footer.public-brand-footer h4,
.site-footer.public-brand-footer h4 {
  color: var(--brand-dark);
  font-weight: 800;
}

.public-brand-footer a,
.footer.public-brand-footer a,
.site-footer.public-brand-footer a {
  color: var(--brand-primary);
  font-weight: 650;
}

.public-brand-footer a:hover,
.footer.public-brand-footer a:hover,
.site-footer.public-brand-footer a:hover {
  color: var(--brand-primary-deep);
}

/* Footer interno: oscuro, con logo contrastado. */
.app-brand-footer,
.app-footer.app-brand-footer {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(300px, 1.25fr) minmax(210px, .75fr) minmax(210px, .75fr) auto;
  align-items: center;
  padding: clamp(2rem, 3.2vw, 3.4rem) clamp(1.5rem, 5vw, 5rem);
  background: linear-gradient(110deg, var(--brand-primary) 0%, var(--brand-primary-deep) 42%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: 0 -20px 48px rgba(15,36,55,.24);
  overflow: hidden;
}

.app-brand-footer *,
.app-footer.app-brand-footer * {
  color: inherit;
}

.app-brand-footer p,
.app-brand-footer span,
.app-brand-footer small,
.app-brand-footer a,
.app-footer.app-brand-footer p,
.app-footer.app-brand-footer span,
.app-footer.app-brand-footer small,
.app-footer.app-brand-footer a {
  color: rgba(255,255,255,.84);
}

.app-brand-footer strong,
.app-footer.app-brand-footer strong,
.app-brand-footer a:hover,
.app-footer.app-brand-footer a:hover {
  color: #fff;
}

.app-brand-footer .footer-brand img,
.app-footer.app-brand-footer .footer-brand img {
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,.34), transparent 48%),
    var(--brand-dark-logo-bg);
  border: 1px solid var(--brand-dark-logo-border);
  box-shadow: 0 14px 30px rgba(0,0,0,.18);
  filter: saturate(1.25) contrast(1.08) brightness(1.18);
}

.app-brand-footer .footer-brand img,
.app-footer.app-brand-footer .footer-brand img {
  border-radius: 18px;
  padding: .45rem;
}

/* Mascota del footer interno: fondo suave para asegurar contraste. */
.footer-mascot-frame {
  width: clamp(128px, 11vw, 185px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center ;
  justify-self: end ;
  padding: clamp(.55rem, 1vw, .9rem);
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 32px;
  background:
    radial-gradient(circle at 35% 22%, rgba(255,255,255,.98), rgba(255,255,255,.82) 52%, rgba(236,253,245,.88) 100%);
  box-shadow:
    0 20px 46px rgba(0,0,0,.20),
    inset 0 0 0 1px rgba(255,255,255,.72);
  overflow: visible;
  filter: none;
}

.footer-mascot-frame .footer-cat,
.app-brand-footer .footer-cat {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 1;
  filter: drop-shadow(0 12px 24px rgba(15,36,55,.18));
}

@media (max-width: 900px) {
  .public-brand-footer,
  .footer.public-brand-footer,
  .site-footer.public-brand-footer,
  .app-brand-footer,
  .app-footer.app-brand-footer {
    grid-template-columns: 1fr 1fr;
  }

  .footer-mascot-frame {
    justify-self: start ;
    width: clamp(112px, 30vw, 150px);
  }
}

@media (max-width: 640px) {
  .public-brand-footer,
  .footer.public-brand-footer,
  .site-footer.public-brand-footer,
  .app-brand-footer,
  .app-footer.app-brand-footer {
    grid-template-columns: 1fr;
    padding: 2rem 1.25rem;
  }

  /* Mantiene el espaciado compacto del footer privado frente al padding
     adicional de mobile-bottom-nav.css, que se carga fuera de @layer. */
  .app-brand-footer,
  .app-footer.app-brand-footer {
    padding: 2rem 1.25rem !important;
  }
}

/* =========================================================
   Layout privado y navegación
   ========================================================= */
@media (min-width: 1100px) {
  .app-body {
    background: #fff;
  }

  .app-top {
    position: sticky;
    top: 0;
    z-index: 920;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .9rem;
    min-height: 72px;
    padding: .55rem clamp(1.4rem, 3vw, 2.5rem);
    border-bottom: 0;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(14px);
    box-shadow: none;
  }

  .app-top .sidebar-toggle {
    display: inline-grid;
    width: 48px;
    height: 48px;
    place-items: center ;
    border: 1px solid var(--brand-border);
    border-radius: 16px;
    background: #fff;
    color: var(--brand-dark);
  }

  .app-top .brand {
    min-width: fit-content;
  }

  .app-top .brand img {
    width: 52px;
    height: 52px;
  }

  .app-top .brand strong {
    font-size: clamp(1.45rem, 2vw, 2.1rem);
  }

  .app-top-spacer {
    display: block;
    min-width: 0;
  }

  .app-top .user-chip {
    justify-self: end ;
    margin-left: auto ;
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: max-content;
  }

  .app-top .user-chip .account-link,
  .app-top .user-chip .logout {
    white-space: nowrap;
  }

  .desktop-top-nav-row {
    position: sticky;
    top: 72px;
    z-index: 900;
    display: block;
    padding: .38rem clamp(1.4rem, 3vw, 2.5rem) .58rem;
    border-bottom: 1px solid rgba(15,36,55,.08);
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 32px rgba(15,36,55,.035);
  }

  body.desktop-sidebar-mode .desktop-top-nav-row {
    display: none;
  }

  body.desktop-topnav-mode .desktop-top-nav-row,
  body:not(.desktop-sidebar-mode) .desktop-top-nav-row {
    display: block;
  }

  .desktop-top-nav-row .desktop-top-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: .4rem;
    overflow: visible;
    scrollbar-width: none;
    width: 100%;
  }

  .desktop-top-nav-row .desktop-top-nav::-webkit-scrollbar {
    display: none;
  }

  .desktop-top-nav-row .desktop-top-nav a,
  .desktop-top-nav-row .desktop-top-more > summary {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    flex: 0 0 auto;
    min-height: 42px;
    padding: .5rem .82rem;
    border-radius: 15px;
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
  }

  .desktop-top-nav-row .desktop-top-nav a.active,
  .desktop-top-nav-row .desktop-top-nav a:hover,
  .desktop-top-nav-row .desktop-top-more[open] > summary,
  .desktop-top-nav-row .desktop-top-more > summary:hover {
    background: var(--brand-primary-pale);
    color: var(--brand-primary);
    box-shadow: inset 0 0 0 1px var(--brand-border);
  }

  .desktop-top-more {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    z-index: 930;
  }

  .desktop-top-more > summary {
    list-style: none;
  }

  .desktop-top-more > summary::-webkit-details-marker {
    display: none;
  }

  .desktop-top-more-menu {
    position: absolute;
    top: calc(100% + .55rem);
    right: 0 ;
    z-index: 940;
    min-width: 265px;
    max-height: min(72vh, 560px);
    overflow-y: auto;
    display: grid;
    gap: .25rem;
    padding: .55rem;
    border: 1px solid var(--brand-border);
    border-radius: 18px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 24px 60px rgba(15,36,55,.16);
  }

  .desktop-top-more:not([open]) > .desktop-top-more-menu {
    display: none;
  }

  .desktop-top-more-menu a {
    justify-content: flex-start;
    width: 100%;
  }

  .top-nav-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
  }

  .app-shell {
    display: block;
    min-height: calc(100vh - 72px);
  }

  .desktop-sidebar-edge,
  body.desktop-topnav-mode .app-shell > .sidebar,
  body:not(.desktop-sidebar-mode) .app-shell > .sidebar {
    display: none;
  }

  body.desktop-sidebar-mode .app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
    min-height: calc(100vh - 72px);
  }

  body.desktop-sidebar-mode .app-shell > .sidebar {
    display: block;
    position: sticky;
    top: 72px;
    align-self: start;
    height: calc(100vh - 72px);
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 2rem;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
  }

  body.desktop-sidebar-mode .app-shell > .app-main {
    grid-column: 2;
    min-width: 0;
  }

  .app-main {
    width: 100%;
    max-width: none;
    padding: clamp(1rem, 2vw, 1.45rem) clamp(1.4rem, 3vw, 2.5rem) 2rem;
  }

  .mobile-bottom-nav,
  .mobile-more-panel {
    display: none;
  }
}

@media (max-width: 1099px) {
  .desktop-top-nav-row,
  .desktop-top-nav,
  .app-top-spacer {
    display: none;
  }
}

@media (min-width: 1100px) {
  .app-top {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .app-top .sidebar-toggle,
  .app-top > .sidebar-toggle {
    display: none;
  }

  .desktop-top-nav-row,
  body.desktop-sidebar-mode .desktop-top-nav-row,
  body.desktop-topnav-mode .desktop-top-nav-row,
  body:not(.desktop-sidebar-mode) .desktop-top-nav-row {
    display: block;
  }

  .app-shell,
  body.desktop-sidebar-mode .app-shell,
  body.sidebar-collapsed .app-shell {
    display: block;
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell > .desktop-sidebar-edge,
  .desktop-sidebar-edge,
  body.sidebar-collapsed .app-shell > .desktop-sidebar-edge,
  body.desktop-sidebar-mode .app-shell > .desktop-sidebar-edge,
  .app-shell > .sidebar,
  body.desktop-sidebar-mode .app-shell > .sidebar,
  body.desktop-topnav-mode .app-shell > .sidebar,
  body.sidebar-collapsed .app-shell > .sidebar,
  body:not(.desktop-sidebar-mode) .app-shell > .sidebar {
    display: none;
  }

  .app-shell > .app-main,
  body.desktop-sidebar-mode .app-shell > .app-main,
  body.desktop-topnav-mode .app-shell > .app-main,
  body.sidebar-collapsed .app-shell > .app-main,
  body:not(.sidebar-collapsed) .app-shell > .app-main {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    margin: 0;
  }
}

/* ---------- Breadcrumbs, cabeceras y tarjetas privadas ---------- */
.app-context-breadcrumb,
.modern-breadcrumb {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0 0 1rem;
  padding: .48rem .75rem;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: linear-gradient(135deg, #fff 0%, var(--brand-primary-pale) 100%);
  color: #64748b;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(15,36,55,.05);
}

.app-context-breadcrumb a,
.modern-breadcrumb a {
  color: var(--brand-primary);
  text-decoration: none;
}

.app-context-breadcrumb strong,
.modern-breadcrumb strong {
  color: var(--brand-dark);
}

.page-head {
  position: relative;
  overflow: hidden;
  margin-bottom: 1.1rem;
  padding: clamp(1.15rem, 2vw, 1.65rem);
  border: 1px solid var(--brand-border);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,.88), transparent 22rem),
    linear-gradient(135deg, #fff 0%, var(--brand-primary-pale) 100%);
  box-shadow: 0 18px 42px rgba(15,36,55,.06);
}

.page-head:has(.inline-danger[open]) {
  overflow: visible;
  z-index: 30;
}

.page-head h1,
.page-head h2 {
  color: var(--brand-dark);
}

.page-head p,
.page-head .muted {
  color: #64748b;
}

.card,
.app-main > .card {
  border-color: var(--brand-border);
  border-radius: 24px;
  box-shadow: 0 16px 38px rgba(15,36,55,.055);
}

.kpi.card {
  background: linear-gradient(135deg, #fff 0%, var(--brand-primary-pale) 100%);
  border-color: var(--brand-border);
}

.kpi.card strong {
  color: var(--brand-primary);
}

html[data-gestfel-theme="dark"] .inventory-kpis .kpi.card {
  background: linear-gradient(135deg, #13282e, #102229);
  border-color: var(--gf-line);
  box-shadow: var(--gf-shadow-soft);
}

html[data-gestfel-theme="dark"] .inventory-kpis .kpi.card strong {
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .inventory-kpis .kpi.card span {
  color: var(--gf-muted);
}

/* =========================================================
   Módulo Colonias
   =========================================================
   Estructura mantenible:
   1. Cabecera y layout principal
   2. Estadísticas laterales en vertical
   3. Listado lateral de colonias
   4. Vista de listado compacto
   5. Mapa, ficha flotante y ayuda
   6. Marcadores Leaflet
   7. Responsive
*/

/* 1. Cabecera y layout principal */
.colonies-map-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: .75rem;
  padding: .25rem 0 .65rem;
  overflow: visible;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.module-title-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 2px solid var(--brand-dark);
  border-radius: 14px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.module-title-icon .app-icon,
.module-title-icon .app-icon-type-pin,
.module-title-icon svg {
  width: 30px;
  height: 30px;
  display: block;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: transparent !important;
  color: currentColor !important;
}

.colonies-map-page {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 1.15rem;
  align-items: stretch;
}

.colonies-left-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: .95rem;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* 2. Estadísticas laterales en matriz compacta */
.colony-stat-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .52rem;
  min-width: 0;
  padding: .58rem;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 18%, var(--brand-border));
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 253, 251, .98)),
    var(--brand-primary-pale);
  box-shadow: 0 10px 26px rgba(15,36,55,.055);
}

.colony-side-stat {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: .5rem;
  min-width: 0;
  min-height: 66px;
  padding: .52rem .58rem;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 26%, #dbe7e3);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255,255,255,.84), transparent 4.8rem),
    linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 9%, #fff) 0%, color-mix(in srgb, var(--brand-primary) 4%, #fff) 100%);
  box-shadow: 0 12px 26px rgba(15,36,55,.045);
}

.colony-side-stat--primary {
  background:
    radial-gradient(circle at 12% 0%, rgba(255,255,255,.88), transparent 4.8rem),
    linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 13%, #fff) 0%, color-mix(in srgb, var(--brand-primary) 5%, #fff) 100%);
}

.colony-side-stat--cats {
  border-color: #bae6fd;
  background: linear-gradient(135deg, #f0fdfa 0%, #eff6ff 100%);
}

.colony-side-stat--ster {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}

.colony-side-stat--alert {
  border-color: #fed7aa;
  background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%);
}

.side-stat-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  color: var(--brand-primary);
  box-shadow: 0 10px 24px rgba(15,36,55,.06);
}

.colony-side-stat--cats .side-stat-icon { color: #0891b2; }
.colony-side-stat--ster .side-stat-icon { color: #2563eb; }
.colony-side-stat--alert .side-stat-icon { color: #d97706; }

.side-stat-icon svg {
  width: 21px;
  height: 21px;
}

.colony-side-stat > div {
  display: grid;
  gap: .08rem;
  min-width: 0;
}

.colony-side-stat strong,
.colony-side-stat small {
  display: block;
  visibility: visible;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.colony-side-stat strong {
  color: var(--brand-dark);
  font-size: .8rem;
  font-weight: 850;
  line-height: 1.12;
}

.colony-side-stat b {
  display: block;
  color: var(--brand-dark);
  font-size: 1.42rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: -.03em;
}

.colony-side-stat small {
  color: #64748b;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.12;
}

/* 3. Listado lateral de colonias */
.colonies-side-list {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: .75rem;
  border-color: color-mix(in srgb, var(--brand-primary) 20%, var(--brand-border)) !important;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.97), rgba(248,253,251,.98)),
    color-mix(in srgb, var(--brand-primary) 5%, #fff);
}

.side-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .55rem;
}

.side-list-head h2 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
}

.side-list-head p {
  margin: .15rem 0 0;
  color: #64748b;
  font-size: .82rem;
  line-height: 1.3;
}

.colony-visual-list {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: .55rem;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: .25rem;
}

.colony-list-card {
  position: relative;
  display: block;
  min-height: 88px;
  height: auto;
  overflow: hidden;
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15,36,55,.045);
  cursor: pointer;
}

.colony-list-card.is-active {
  border-color: var(--brand-primary);
  box-shadow: 0 14px 32px rgba(15,36,55,.09);
}

.colony-list-card:focus-visible {
  outline: 3px solid rgba(var(--brand-primary-rgb), .24);
  outline-offset: 3px;
}

.colony-list-card__button {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: .6rem;
  width: 100%;
  min-height: 58px;
  height: auto;
  padding: .55rem .65rem .4rem;
  overflow: visible;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.colony-list-card__button:disabled {
  cursor: default;
  opacity: .78;
}

.colony-list-card.is-unmapped {
  cursor: default;
}

.colony-thumb {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.colony-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.colony-thumb .app-icon,
.colony-thumb svg {
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  background: transparent !important;
  color: currentColor !important;
}

.colony-list-card__body {
  min-width: 0;
}

.colony-list-card__body strong,
.colony-list-card__body small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.colony-list-card__body strong {
  color: var(--brand-dark);
  font-size: .92rem;
  font-weight: 850;
  line-height: 1.12;
}

.colony-list-card__body small {
  margin-top: .12rem;
  color: #64748b;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.1;
}

.colony-status-pill {
  width: fit-content;
  padding: .24rem .5rem;
  border-radius: 999px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
  font-weight: 850;
  font-size: .74rem;
  white-space: nowrap;
}

.colony-status-pill--urgente { background: #fef2f2; color: #dc2626; }
.colony-status-pill--atencion { background: #fffbeb; color: #d97706; }
.colony-status-pill--seguimiento { background: #ecfeff; color: #0891b2; }

.colony-list-card__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
  min-height: 28px;
  height: auto;
  padding: 0 .65rem .55rem calc(46px + 1.25rem);
  overflow: visible;
}

.colony-list-card__actions a {
  color: var(--brand-primary);
  font-size: .85rem;
  font-weight: 850;
  text-decoration: none;
}

.colony-list-card__mobile-detail {
  display: none;
}

.colonies-list-footer {
  padding-top: .55rem;
  background: #fff;
}

.colonies-show-all {
  width: 100%;
  justify-content: center;
  margin: 0;
  min-height: 38px;
  padding: .5rem .9rem;
  font-size: .9rem;
}

body.colonies-list-expanded .colonies-left-panel,
body.colonies-list-expanded .colonies-side-list,
body.colonies-list-expanded .colony-visual-list {
  overflow: visible;
}



/* 4. Vista de listado compacto de colonias */
.colonies-view-toggle {
  white-space: nowrap;
}

.colonies-list-mode[hidden] {
  display: none;
}

.colonies-list-mode {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 24px;
}

.colonies-list-mode__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.colonies-list-mode__head h2 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.colonies-list-mode__head p {
  margin: .25rem 0 0;
  color: #64748b;
  font-weight: 650;
}

.colonies-compact-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--brand-border);
  border-radius: 20px;
  background: #fff;
}

.colonies-compact-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.colonies-compact-table th,
.colonies-compact-table td {
  padding: .78rem .85rem;
  border-bottom: 1px solid #e7efec;
  text-align: left;
  vertical-align: middle;
}

.colonies-compact-table th {
  color: #64748b;
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .02em;
  text-transform: uppercase;
  background: #f8fafc;
}

.colonies-compact-table tbody tr {
  cursor: pointer;
  transition: background .16s ease, box-shadow .16s ease;
}

.colonies-compact-table tbody tr:hover,
.colonies-compact-table tbody tr.is-selected {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 8%, #fff) 0%, #fff 100%);
}

.colonies-compact-table tbody tr.is-selected {
  box-shadow: inset 3px 0 0 var(--brand-primary);
}

.colonies-compact-main {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: .75rem;
  align-items: center;
  min-width: 260px;
}

.colonies-compact-photo {
  width: 58px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.colonies-compact-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.colonies-compact-photo .app-icon,
.colonies-compact-photo svg {
  width: 26px;
  height: 26px;
  background: transparent;
}

.colonies-compact-main strong,
.colonies-compact-main small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.colonies-compact-main strong {
  color: var(--brand-dark);
  font-weight: 850;
}

.colonies-compact-main small {
  margin-top: .18rem;
  color: #64748b;
  font-weight: 650;
}

.colonies-compact-number {
  color: var(--brand-dark);
  font-weight: 850;
  white-space: nowrap;
}

.colonies-compact-muted {
  color: #64748b;
  font-weight: 700;
}

.colonies-progress {
  display: grid;
  gap: .35rem;
  min-width: 120px;
}

.colonies-progress span {
  color: var(--brand-dark);
  font-weight: 850;
}

.colonies-progress-bar {
  height: .36rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ece9;
}

.colonies-progress-bar > i {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--brand-primary);
}

.colonies-health-dot {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  color: var(--brand-dark);
  font-weight: 800;
  white-space: nowrap;
}

.colonies-health-dot::before {
  content: "";
  width: .55rem;
  height: .55rem;
  border-radius: 999px;
  background: #16a34a;
}

.colonies-health-dot--warning::before { background: #f59e0b; }
.colonies-health-dot--danger::before { background: #dc2626; }

.colonies-row-actions {
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  white-space: nowrap;
}

.colonies-row-actions a {
  color: var(--brand-primary);
  font-weight: 850;
  text-decoration: none;
}

.colonies-list-detail {
  display: grid;
  grid-template-columns: minmax(240px, 330px) minmax(0, 1fr) minmax(260px, 340px);
  gap: 1rem;
  align-items: stretch;
  padding: 1rem;
  border: 1px solid var(--brand-border);
  border-radius: 24px;
  background: #fff;
}

.colonies-list-detail.has-no-photo {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
}

.colonies-list-detail__photo {
  min-height: 190px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-primary-pale), #fff);
}

.colonies-list-detail__photo[hidden] {
  display: none;
}

.colonies-list-detail__photo img {
  width: 100%;
  height: 100%;
  min-height: 190px;
  object-fit: cover;
  display: block;
}

.colonies-list-detail__body {
  display: grid;
  align-content: start;
  gap: .75rem;
  min-width: 0;
}

.colonies-list-detail__title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
}

.colonies-list-detail__title h3 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
}

.colonies-list-detail__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem 1rem;
  color: #64748b;
  font-weight: 750;
}

.colonies-list-detail__metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
}

.colonies-list-detail__metrics span {
  display: grid;
  gap: .12rem;
  padding: .65rem .75rem;
  border: 1px solid #e5ece9;
  border-radius: 16px;
  background: #f8fafc;
  color: #64748b;
  font-weight: 750;
}

.colonies-list-detail__metrics strong {
  color: var(--brand-primary);
  font-size: 1.25rem;
}

.colonies-list-detail__aside {
  display: grid;
  gap: .65rem;
  align-content: start;
}

.colonies-list-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 46px;
  padding: .7rem .8rem;
  border: 1px solid #e5ece9;
  border-radius: 14px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 850;
  text-decoration: none;
}

.colonies-list-action:hover {
  color: var(--brand-primary);
  background: var(--brand-primary-pale);
}

.colonies-list-action--danger {
  color: #b91c1c;
  background: #fff1f2;
  border-color: #fecdd3;
}

/* 5. Mapa, ficha flotante y ayuda */
.colonies-map-shell {
  position: relative;
  min-width: 0;
  min-height: 620px;
  overflow: hidden;
  padding: 0;
  border-color: color-mix(in srgb, var(--brand-primary) 22%, var(--brand-border)) !important;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.97), rgba(248,253,251,.98)),
    color-mix(in srgb, var(--brand-primary) 5%, #fff);
}

.colonies-modern-map {
  width: 100%;
  height: 100%;
  min-height: 620px;
  background: var(--brand-primary-pale);
  filter: saturate(.86) contrast(.96) brightness(1.03);
}

.colony-floating-card {
  position: absolute;
  right: clamp(1rem, 2vw, 1.5rem);
  top: clamp(1rem, 2vw, 1.5rem);
  z-index: 500;
  width: min(340px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow-y: auto;
  padding: .85rem;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 20px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 22px 54px rgba(15,36,55,.18);
  backdrop-filter: blur(12px);
}

.colony-floating-card h2 {
  margin: 0 0 .4rem;
  padding-right: 2.3rem;
  color: var(--brand-dark);
  font-size: 1.22rem;
  line-height: 1.15;
}

.colony-floating-card p {
  margin: .55rem 0;
  color: #64748b;
  font-size: .88rem;
  line-height: 1.3;
}

.colony-floating-card .btn {
  width: 100%;
  justify-content: center;
  min-height: 40px;
  padding: .55rem .9rem;
  font-size: .92rem;
}

.colony-floating-card[hidden],
.colony-floating-card:not(.is-visible) {
  display: none;
}

.colony-floating-close {
  position: absolute;
  right: .75rem;
  top: .55rem;
  z-index: 5;
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--brand-dark);
  font-size: 0;
  line-height: 1;
  text-indent: -9999px;
  cursor: pointer;
  transform: none;
}

.colony-floating-close::before,
.colony-floating-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.58rem;
  height: .22rem;
  border-radius: 999px;
  background: currentColor;
  transform-origin: 50% 50%;
  transition: transform .18s ease, background-color .18s ease, opacity .18s ease;
}

.colony-floating-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.colony-floating-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.colony-floating-close:hover,
.colony-floating-close:active { color: var(--brand-primary); background: transparent; transform: none; }
.colony-floating-close:hover::before { transform: translate(-50%, -50%) rotate(135deg); }
.colony-floating-close:hover::after { transform: translate(-50%, -50%) rotate(45deg); }
.colony-floating-close:focus-visible { outline: 3px solid var(--brand-accent); outline-offset: 3px; }

.floating-colony-photo {
  width: 100%;
  height: 116px;
  object-fit: cover;
  border-radius: 14px;
  margin: .55rem 0 .4rem;
  background: var(--brand-primary-pale);
}

.floating-card-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: .55rem;
  align-items: center;
  padding: .48rem 0;
  border-top: 1px solid #e5ece9;
}

.floating-card-row > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.floating-card-row > span svg {
  width: 18px;
  height: 18px;
}

.floating-card-row strong,
.floating-card-row small { display: block; }
.floating-card-row strong { font-size: .88rem; line-height: 1.2; }
.floating-card-row small { color: #64748b; font-size: .78rem; line-height: 1.22; }

.floating-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .4rem;
  margin: .55rem 0;
}

.floating-metrics span {
  padding: .42rem .35rem;
  border-radius: 14px;
  background: #f8fafc;
  color: #64748b;
  text-align: center;
  font-weight: 700;
  font-size: .8rem;
}

.floating-metrics strong {
  display: block;
  color: var(--brand-primary);
  font-size: 1.12rem;
}

.colonies-help-card-wide {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin-top: 1.15rem;
  padding: 1rem 1.25rem;
  border-radius: 24px;
}

.colonies-help-card-wide > span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
}

.colonies-help-card-wide p {
  margin: .1rem 0 0;
  color: #64748b;
}

/* 6. Marcadores Leaflet */
.colony-leaflet-div-icon { background: transparent !important; border: 0 !important; }

.colony-map-marker {
  position: relative;
  display: grid;
  justify-items: center;
  width: 60px;
  height: 80px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translateZ(0);
  transition: filter .16s ease;
}

.colony-map-marker:hover { filter: drop-shadow(0 14px 18px rgba(15,36,55,.26)); }

.colony-map-marker__pin {
  position: relative;
  width: 50px;
  height: 54px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand-primary);
  border: 3px solid #fff;
  border-radius: 25px 25px 26px 26px;
  box-shadow: 0 12px 22px rgba(15,36,55,.22), 0 0 0 8px color-mix(in srgb, var(--brand-primary) 18%, transparent);
  transition: transform .16s ease, box-shadow .16s ease;
}

.colony-map-marker__pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 20px;
  height: 20px;
  background: inherit;
  border-right: 3px solid #fff;
  border-bottom: 3px solid #fff;
  border-radius: 0 0 6px 0;
  transform: translateX(-50%) rotate(45deg);
  z-index: -1;
}

.colony-map-marker__pin::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  transform: scale(.72);
  z-index: -2;
  pointer-events: none;
}

.colony-map-marker:hover .colony-map-marker__pin { transform: translateY(-3px) scale(1.04); }

.colony-map-marker__cat {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: var(--brand-primary);
  box-shadow: inset 0 0 0 1px rgba(15,36,55,.06);
}

.colony-map-marker__cat svg {
  width: 23px;
  height: 23px;
  display: block;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.colony-map-marker__label {
  position: absolute;
  top: 78px;
  left: 50%;
  width: max-content;
  max-width: 170px;
  transform: translateX(-50%);
  padding: .22rem .52rem;
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: var(--brand-dark);
  box-shadow: 0 8px 20px rgba(15,36,55,.12);
  font-size: .72rem;
  font-weight: 850;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  pointer-events: none;
}

.colony-map-marker--seguimiento .colony-map-marker__pin { background: #0891b2; box-shadow: 0 12px 22px rgba(15,36,55,.22), 0 0 0 8px rgba(8,145,178,.16); }
.colony-map-marker--seguimiento .colony-map-marker__cat { color: #0891b2; }
.colony-map-marker--atencion .colony-map-marker__pin { background: #d97706; box-shadow: 0 12px 22px rgba(15,36,55,.22), 0 0 0 8px rgba(217,119,6,.16); }
.colony-map-marker--atencion .colony-map-marker__cat { color: #d97706; }
.colony-map-marker--urgente .colony-map-marker__pin { background: #dc2626; box-shadow: 0 12px 22px rgba(15,36,55,.22), 0 0 0 8px rgba(220,38,38,.16); }
.colony-map-marker--urgente .colony-map-marker__cat { color: #dc2626; }
.colony-map-marker--urgente .colony-map-marker__pin::before { color: #dc2626; animation: colonyUrgentPulse 1.9s ease-out infinite; }

.colony-map-marker.is-active { width: 78px; height: 98px; filter: drop-shadow(0 18px 26px rgba(15,36,55,.30)); }

.colony-map-marker.is-active .colony-map-marker__pin {
  width: 64px;
  height: 68px;
  border-width: 4px;
  border-radius: 32px 32px 33px 33px;
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 18px 32px rgba(15,36,55,.30), 0 0 0 10px rgba(255,255,255,.72), 0 0 0 18px color-mix(in srgb, var(--brand-primary) 22%, transparent);
}

.colony-map-marker.is-active .colony-map-marker__pin::after {
  bottom: -12px;
  width: 24px;
  height: 24px;
  border-right-width: 4px;
  border-bottom-width: 4px;
  border-radius: 0 0 7px 0;
}

.colony-map-marker.is-active .colony-map-marker__cat { width: 39px; height: 39px; }
.colony-map-marker.is-active .colony-map-marker__cat svg { width: 29px; height: 29px; }

.colony-map-marker.is-active .colony-map-marker__label {
  top: 95px;
  max-width: 210px;
  padding: .28rem .65rem;
  color: #fff;
  background: var(--brand-primary);
  border-color: #fff;
  font-size: .78rem;
}

.colony-map-marker--seguimiento.is-active .colony-map-marker__label { background: #0891b2; }
.colony-map-marker--atencion.is-active .colony-map-marker__label { background: #d97706; }
.colony-map-marker--urgente.is-active .colony-map-marker__label { background: #dc2626; }
.colony-map-marker--urgente.is-active .colony-map-marker__pin::before { inset: -14px; animation-duration: 1.55s; }

@keyframes colonyUrgentPulse {
  0% { opacity: .34; transform: scale(.72); }
  70%, 100% { opacity: 0; transform: scale(1.34); }
}

@media (prefers-reduced-motion: reduce) {
  .colony-map-marker--urgente .colony-map-marker__pin::before { animation: none; opacity: .18; transform: scale(1.1); }
  .colony-floating-close::before,
  .colony-floating-close::after { transition: none; }
}

/* 7. Responsive */
@media (min-width: 1100px) {
  /* El eyebrow y el subtítulo se ocultan para ceder su alto al mapa y al listado. */
  .colonies-map-title .eyebrow,
  .colonies-map-title p {
    display: none;
  }

  .colonies-map-page,
  .colonies-left-panel,
  .colonies-map-shell,
  .colonies-modern-map {
    min-height: calc(100vh - 168px);
    height: calc(100vh - 168px);
  }

  .colonies-left-panel {
    max-height: calc(100vh - 168px);
  }

  /* Al mostrar todas las colonias, el contenedor debe crecer y empujar el footer. */
  body.colonies-list-expanded .colonies-map-page {
    height: auto;
    min-height: calc(100vh - 168px);
    align-items: start;
  }

  body.colonies-list-expanded .colonies-left-panel,
  body.colonies-list-expanded .colonies-side-list,
  body.colonies-list-expanded .colony-visual-list {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  body.colonies-list-expanded .colonies-map-shell {
    position: sticky;
    top: 148px;
    height: calc(100vh - 168px);
    min-height: calc(100vh - 168px);
  }
}

@media (min-width: 1100px) and (max-height: 820px) {
  .app-top {
    min-height: 62px;
    padding-top: .35rem;
    padding-bottom: .35rem;
  }

  .desktop-top-nav-row {
    top: 62px;
    padding-top: .25rem;
    padding-bottom: .35rem;
  }

  .desktop-top-nav-row .desktop-top-nav a,
  .desktop-top-nav-row .desktop-top-more > summary {
    min-height: 36px;
    padding: .38rem .62rem;
    font-size: .9rem;
  }

  .colonies-map-title .eyebrow,
  .colonies-map-title p {
    display: none;
  }

  .colonies-map-page,
  .colonies-left-panel,
  .colonies-map-shell,
  .colonies-modern-map {
    min-height: calc(100vh - 155px);
    height: calc(100vh - 155px);
  }

  .colonies-left-panel {
    max-height: calc(100vh - 155px);
  }

  body.colonies-list-expanded .colonies-map-page {
    height: auto;
    min-height: calc(100vh - 155px);
  }

  body.colonies-list-expanded .colonies-left-panel,
  body.colonies-list-expanded .colonies-side-list,
  body.colonies-list-expanded .colony-visual-list {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  body.colonies-list-expanded .colonies-map-shell {
    top: 112px;
    height: calc(100vh - 155px);
    min-height: calc(100vh - 155px);
  }

  .colony-stat-stack {
    gap: .48rem;
    padding: .55rem;
  }

  .colony-side-stat {
    min-height: 62px;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: .48rem;
    padding: .48rem .55rem;
  }

  .side-stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .side-stat-icon svg {
    width: 20px;
    height: 20px;
  }

  .colony-side-stat strong {
    font-size: .8rem;
  }

  .colony-side-stat b {
    font-size: 1.32rem;
  }

  .colony-side-stat small {
    font-size: .7rem;
  }
}

@media (max-width: 1180px) {
  .colonies-map-page {
    grid-template-columns: 1fr;
  }

  .colonies-left-panel,
  .colonies-map-shell,
  .colonies-modern-map {
    height: auto;
    max-height: none;
  }

  .colonies-left-panel {
    overflow: visible;
  }

  .colony-visual-list {
    max-height: 560px;
  }

  body.colonies-list-expanded .colony-visual-list {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .colonies-map-title {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .colonies-map-title .page-actions {
    grid-column: 1 / -1;
  }

  .colony-list-card__button {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .colony-thumb {
    width: 54px;
    height: 54px;
  }

  .colony-status-pill {
    grid-column: 2;
    justify-self: start;
  }

  .colony-list-card__actions {
    padding-left: .75rem;
  }

  .colonies-map-shell,
  .colonies-modern-map {
    min-height: 460px;
  }

  .colony-floating-card {
    position: static;
    width: auto;
    margin: 1rem;
  }

  .colonies-help-card-wide {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .colonies-help-card-wide .btn {
    grid-column: 1 / -1;
  }
}

/* Colonias móvil: tabla compacta como carrusel paginado */
@media (max-width: 820px) {
  .colonies-list-mode .colonies-compact-table-wrap {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    padding: .1rem .05rem .45rem;
  }

  .colonies-list-mode .colonies-compact-table {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none;
    border-spacing: 0;
  }

  .colonies-list-mode .colonies-compact-table thead {
    display: none;
  }

  .colonies-list-mode .colonies-compact-table tbody {
    display: flex;
    gap: .72rem;
    width: fit-content;
    min-width: 0;
  }

  .colonies-list-mode .colonies-compact-table tr {
    flex: 0 0 calc(100vw - 2.25rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .52rem;
    max-width: 440px;
    width: auto;
    margin: 0;
    padding: .82rem;
    scroll-snap-align: start;
  }

  .colonies-list-mode .colonies-compact-table tr.is-page-hidden,
  .colonies-list-mode .colonies-compact-table tr.is-filtered-out,
  .colonies-list-mode .colonies-compact-table tr[hidden] {
    display: none;
  }

  .colonies-list-mode .colonies-compact-table td {
    display: flex !important;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    gap: .45rem;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .colonies-list-mode .colonies-compact-table td:nth-child(1),
  .colonies-list-mode .colonies-compact-table td:nth-child(4),
  .colonies-list-mode .colonies-compact-table td:nth-child(5),
  .colonies-list-mode .colonies-compact-table td:nth-child(7) {
    grid-column: 1 / -1;
  }

  .colonies-list-mode .colonies-compact-table td:nth-child(2),
  .colonies-list-mode .colonies-compact-table td:nth-child(3),
  .colonies-list-mode .colonies-compact-table td:nth-child(6) {
    display: grid !important;
    grid-template-columns: 1fr;
    justify-items: start ;
    align-content: start ;
  }

  .colonies-list-mode .colonies-compact-table td:nth-child(3) {
    justify-self: end ;
  }

  .colonies-list-mode .colonies-compact-main {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: .62rem;
  }

  .colonies-list-mode .colonies-compact-photo {
    width: 54px;
    height: 46px;
  }

  .colonies-list-mode .colonies-row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* Colonias móvil: KPIs en matriz 2×2 */
@media (max-width: 820px) {
  .colony-stat-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .62rem;
  }

  .colony-side-stat {
    min-height: 118px;
    grid-template-columns: 1fr;
    justify-items: center ;
    align-content: center ;
    gap: .34rem;
    padding: .72rem .5rem;
    text-align: center;
  }

  .side-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 16px;
  }

  .side-stat-icon svg {
    width: 23px;
    height: 23px;
  }

  .colony-side-stat > div {
    justify-items: center ;
    gap: .12rem;
    width: 100%;
    min-width: 0;
  }

  .colony-side-stat strong,
  .colony-side-stat small {
    max-width: 13ch;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
    text-align: center;
    text-wrap: balance;
  }

  .colony-side-stat strong {
    font-size: .9rem;
    line-height: 1.1;
  }

  .colony-side-stat b {
    font-size: 1.62rem;
    line-height: .98;
    text-align: center;
  }

  .colony-side-stat small {
    font-size: .75rem;
    line-height: 1.12;
  }
}

@media (max-width: 360px) {
  .colony-stat-stack {
    gap: .5rem;
  }

  .colony-side-stat {
    min-height: 112px;
    padding: .62rem .38rem;
  }

  .side-stat-icon {
    width: 40px;
    height: 40px;
  }

  .colony-side-stat strong {
    font-size: .82rem;
  }

  .colony-side-stat b {
    font-size: 1.48rem;
  }

  .colony-side-stat small {
    font-size: .68rem;
  }
}

/* Colonias móvil: vista mapa — mapa primero, lista en carrusel */
@media (max-width: 820px) {
  .colonies-map-page {
    display: grid;
    grid-template-columns: 1fr;
    gap: .85rem;
  }

  .colonies-left-panel {
    display: contents;
  }

  .colony-stat-stack {
    order: 1 ;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
    padding: .68rem;
    border-radius: 20px;
  }

  .colonies-map-shell {
    order: 2 ;
    min-height: 360px;
    border-radius: 20px;
  }

  .colonies-modern-map {
    min-height: 360px;
  }

  .colonies-side-list {
    order: 3 ;
    overflow: hidden;
    padding: .78rem;
  }

  .colony-visual-list {
    display: flex;
    gap: .72rem;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: .05rem .05rem .45rem;
    scroll-snap-type: x mandatory;
  }

  .colony-list-card {
    flex: 0 0 calc(100vw - 2.25rem);
    max-width: 430px;
    min-height: 112px;
    scroll-snap-align: center;
  }

  .colony-list-card.is-carousel-hidden {
    display: none;
  }

  .colony-list-card__button {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    gap: .58rem;
    min-height: 68px;
    padding: .68rem .7rem .45rem;
  }

  .colony-thumb {
    width: 50px;
    height: 50px;
    border-radius: 15px;
  }

  .colony-list-card__body strong,
  .colony-list-card__body small {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .colony-list-card__actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    padding: 0 .7rem .62rem calc(50px + 1.28rem);
  }

  .colony-list-card__mobile-detail {
    display: grid;
    gap: .52rem;
    padding: 0 .7rem .58rem calc(50px + 1.28rem);
  }

  .colony-list-card__mobile-detail p {
    margin: 0;
    color: #64748b;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.18;
  }

  .colony-card-care-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
  }

  .colony-card-care-grid span {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: .32rem .38rem;
    align-items: start;
    min-width: 0;
    padding: .5rem;
    border-radius: 14px;
    background: #f8fafc;
  }

  .colony-card-care-grid .app-icon,
  .colony-card-care-grid svg {
    grid-row: 1 / span 2;
    width: 24px;
    height: 24px;
    color: var(--brand-primary) !important;
  }

  .colony-card-care-grid strong,
  .colony-card-care-grid small {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .colony-card-care-grid strong {
    color: var(--brand-dark);
    font-size: .78rem;
    line-height: 1.05;
  }

  .colony-card-care-grid small {
    color: #64748b;
    font-size: .68rem;
    line-height: 1.08;
  }

  .colony-card-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .38rem;
  }

  .colony-card-metrics span {
    padding: .45rem .32rem;
    border-radius: 14px;
    background: linear-gradient(180deg, #fff, #f8fafc);
    color: #64748b;
    text-align: center;
    font-size: .72rem;
    font-weight: 800;
    line-height: 1.08;
  }

  .colony-card-metrics strong {
    display: block;
    color: var(--brand-primary);
    font-size: 1.05rem;
    line-height: .98;
  }

  .colonies-list-footer {
    padding-top: .45rem;
    background: transparent;
  }

  .colonies-show-all {
    display: none;
  }

  .colonies-map-carousel-pagination {
    display: flex !important;
    margin-top: 0;
  }

  .colonies-map-carousel-pagination[hidden] {
    display: none;
  }

  body.colonies-list-expanded .colony-visual-list {
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
}

/* En escritorio el paginador es solo un resto del carrusel móvil:
   doble clase para ganar a `.pro-pagination { display:flex }`. */
.pro-pagination.colonies-map-carousel-pagination {
  display: none;
}

@media (max-width: 820px) {
  .colony-floating-card {
    display: none;
  }

  .colony-floating-close {
    right: .28rem ;
    top: .22rem;
    width: 1.85rem;
    height: 1.85rem;
  }

  .colony-floating-close::before,
  .colony-floating-close::after {
    width: 1.05rem;
    height: .16rem;
  }

  .colony-floating-card h2 {
    grid-column: 1;
    margin: 0;
    padding-right: 1.8rem ;
    font-size: .94rem;
    line-height: 1.1;
  }

  .colony-floating-card > .colony-status-pill {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    margin-right: 1.45rem ;
    font-size: .68rem;
    padding: .22rem .45rem;
  }

  .floating-colony-photo {
    display: none;
  }

  .colony-floating-card p {
    grid-column: 1 / -1;
    margin: 0;
    color: #64748b;
    font-size: .72rem;
    line-height: 1.14;
  }

  .floating-card-row {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: .38rem;
    padding: .26rem 0;
  }

  .floating-card-row > span {
    width: 24px;
    height: 24px;
    border-radius: 9px;
  }

  .floating-card-row strong {
    font-size: .72rem;
    line-height: 1.08;
  }

  .floating-card-row small {
    font-size: .64rem;
    line-height: 1.12;
  }

  .floating-metrics {
    grid-column: 1 / -1;
    gap: .3rem;
    margin: .05rem 0 .12rem;
  }

  .floating-metrics span {
    padding: .28rem .22rem;
    border-radius: 12px;
    font-size: .68rem;
    line-height: 1.08;
  }

  .floating-metrics strong {
    font-size: .96rem;
  }

  .colony-floating-card .btn {
    grid-column: 1 / -1;
    min-height: 30px;
    padding: .34rem .55rem;
    font-size: .72rem;
  }
}

/* =========================
   Colonias · vista listado compacto y filtros
   ========================= */
.colonies-map-page[hidden],
.colonies-map-page.is-hidden,
.colonies-list-mode[hidden],
.colonies-list-mode.is-hidden {
  display: none;
}

.colonies-list-filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(165px, 1fr)) auto auto;
  gap: .75rem;
  align-items: end;
  padding: .85rem;
  border: 1px solid var(--brand-border);
  border-radius: 20px;
  background: linear-gradient(135deg, #ffffff 0%, color-mix(in srgb, var(--brand-primary) 5%, #ffffff) 100%);
}

.colonies-list-filters label {
  display: grid;
  gap: .32rem;
  min-width: 0;
}

.colonies-list-filters label > span {
  color: #64748b;
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.colonies-list-filters input,
.colonies-list-filters select {
  width: 100%;
  min-height: 42px;
  padding: .55rem .7rem;
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  background: #fff;
  color: var(--brand-dark);
  font: inherit;
  font-weight: 700;
}

.colonies-list-filters input:focus,
.colonies-list-filters select:focus {
  outline: 3px solid color-mix(in srgb, var(--brand-primary) 18%, transparent);
  border-color: var(--brand-primary);
}

.colonies-filter-count {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .55rem .8rem;
  border-radius: 999px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
  font-weight: 850;
  white-space: nowrap;
}

.colonies-compact-table tbody tr[hidden],
.colonies-compact-table tbody tr.is-filtered-out {
  display: none;
}

.colonies-compact-mode .colonies-help-card-wide {
  margin-top: 1rem;
}

@media (max-width: 1280px) {
  .colonies-list-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .colonies-list-filters .btn,
  .colonies-filter-count {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .colonies-list-filters {
    grid-template-columns: 1fr;
  }
}

/* ---------- Listado compacto en móvil ----------
   En móvil la tabla no debe provocar scroll horizontal.
   Se transforma en tarjetas apiladas manteniendo toda la información. */
@media (max-width: 820px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-main,
  .colonies-list-mode,
  .colonies-compact-table-wrap,
  .colonies-list-detail {
    max-width: 100%;
    min-width: 0;
  }

  .colonies-list-mode {
    padding: .75rem;
    overflow: hidden;
  }

  .colonies-list-mode__head {
    display: grid;
    gap: .65rem;
  }

  .colonies-list-mode__head .btn,
  .colonies-view-toggle {
    width: 100%;
    justify-content: center;
  }

  .colonies-list-filters {
    grid-template-columns: 1fr;
    padding: .75rem;
  }

  .colonies-filter-count {
    width: 100%;
  }

  .colonies-compact-table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .colonies-compact-table {
    display: block;
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .colonies-compact-table thead {
    display: none;
  }

  .colonies-compact-table tbody {
    display: grid;
    gap: .8rem;
    width: 100%;
  }

  .colonies-compact-table tr {
    display: grid;
    gap: .55rem;
    width: 100%;
    padding: .85rem;
    border: 1px solid var(--brand-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15,36,55,.06);
  }

  .colonies-compact-table tr.is-selected {
    box-shadow:
      inset 4px 0 0 var(--brand-primary),
      0 14px 34px rgba(15,36,55,.08);
  }

  .colonies-compact-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .colonies-compact-table td::before {
    flex: 0 0 auto;
    color: #64748b;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .02em;
    text-transform: uppercase;
  }

  .colonies-compact-table td:nth-child(1) {
    display: block;
  }

  .colonies-compact-table td:nth-child(1)::before {
    display: none;
  }

  .colonies-compact-table td:nth-child(2)::before { content: "Estado"; }
  .colonies-compact-table td:nth-child(3)::before { content: "Gatos"; }
  .colonies-compact-table td:nth-child(4)::before { content: "Responsable"; }
  .colonies-compact-table td:nth-child(5)::before { content: "Esterilización"; }
  .colonies-compact-table td:nth-child(6)::before { content: "Bienestar"; }
  .colonies-compact-table td:nth-child(7)::before { content: "Acciones"; }

  .colonies-compact-main {
    grid-template-columns: 74px minmax(0, 1fr);
    min-width: 0;
    width: 100%;
  }

  .colonies-compact-photo {
    width: 70px;
    height: 54px;
    border-radius: 14px;
  }

  .colonies-compact-main strong,
  .colonies-compact-main small {
    white-space: normal;
    text-overflow: clip;
  }

  .colonies-compact-muted {
    max-width: 58%;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .colonies-progress {
    min-width: 0;
    width: min(170px, 48vw);
    justify-items: end;
  }

  .colonies-progress-bar {
    width: 100%;
    min-width: 110px;
  }

  .colonies-health-dot {
    white-space: normal;
    justify-content: flex-end;
    text-align: right;
  }

  .colonies-row-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    white-space: normal;
  }

  .colonies-row-actions a {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    padding: .25rem .45rem;
  }

  .colonies-list-detail {
    grid-template-columns: 1fr !important;
  }

  .colonies-list-detail__photo {
    min-height: 180px;
  }

  .colonies-list-detail__photo img {
    min-height: 180px;
  }

  .colonies-list-detail__metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .colonies-list-detail__aside {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .colonies-list-mode {
    padding: .55rem;
  }

  .colonies-compact-table tr {
    padding: .7rem;
    border-radius: 18px;
  }

  .colonies-compact-main {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: .65rem;
  }

  .colonies-compact-photo {
    width: 60px;
    height: 48px;
  }

  .colonies-list-detail__metrics {
    grid-template-columns: 1fr;
  }
}

/* Colonias: ficha seleccionada visible y footer móvil */
.colonies-list-mode .colonies-list-detail {
  order: 2;
}

.colonies-list-mode .colonies-compact-table-wrap {
  order: 3;
}

.colonies-list-mode .colonies-list-filters {
  order: 1;
}

.colonies-list-mode__head {
  order: 0;
}

@media (max-width: 820px) {
  .colonies-list-mode .colonies-list-detail {
    margin-bottom: .25rem;
  }

  .colonies-list-detail__photo {
    min-height: 150px;
  }

  .colonies-list-detail__photo img {
    min-height: 150px;
  }

}

@media (max-width: 640px) {
  .app-brand-footer,
  .app-footer.app-brand-footer {
    gap: 1.15rem;
    align-items: start;
  }

  .footer-mascot-frame {
    justify-self: start ;
    width: 104px;
    max-width: 104px;
    min-width: 104px;
    padding: .48rem;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid rgba(255,255,255,.82);
    box-shadow:
      0 12px 28px rgba(0,0,0,.18),
      inset 0 0 0 1px rgba(11,125,109,.08);
  }

  .footer-mascot-frame .footer-cat,
  .app-brand-footer .footer-cat,
  .app-footer.app-brand-footer .footer-cat {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 88px;
    max-height: 88px;
    object-fit: contain;
    opacity: 1;
    filter: saturate(1.08) contrast(1.05) brightness(1.03);
    mix-blend-mode: normal;
  }
}

@media (max-width: 420px) {
  .footer-mascot-frame {
    width: 88px;
    max-width: 88px;
    min-width: 88px;
    border-radius: 20px;
  }

  .footer-mascot-frame .footer-cat,
  .app-brand-footer .footer-cat,
  .app-footer.app-brand-footer .footer-cat {
    max-width: 74px;
    max-height: 74px;
  }
}

/* =========================================================
   Listados profesionales horizontales: gatos y colonias
   ========================================================= */
.module-pro-head,
.list-work-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.module-pro-head {
  margin-bottom: 1rem;
}

.module-pro-title {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  min-width: 0;
}

.module-pro-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  flex: 0 0 62px;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 20%, transparent);
  border-radius: 20px;
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--brand-primary) 14%, #fff) 0%,
    color-mix(in srgb, var(--brand-primary) 6%, #fff) 100%);
  color: var(--brand-primary);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand-primary) 22%, transparent),
              inset 0 1px 0 rgba(255,255,255,.9);
}

.module-pro-icon svg {
  width: 32px;
  height: 32px;
  background: transparent;
}

.module-pro-title h1 {
  margin: .15rem 0 .25rem;
  color: var(--brand-dark);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.05;
}

.module-pro-title p,
.list-work-toolbar p {
  margin: .2rem 0 0;
  color: #64748b;
  font-weight: 650;
}

.module-pro-actions,
.list-work-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .7rem;
  flex-wrap: wrap;
}

.list-work-card {
  display: grid;
  gap: .9rem;
  padding: 1rem;
}

.list-work-toolbar h2 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
}

.list-search-form {
  display: flex;
  align-items: center;
  min-width: min(320px, 100%);
  border: 2px solid var(--brand-border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.list-search-form input {
  width: 100%;
  min-height: 44px;
  padding: .55rem .75rem;
  border: 0;
  outline: 0;
  color: var(--brand-dark);
  font-weight: 700;
}

.list-search-form button {
  width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--brand-primary);
  cursor: pointer;
}

.list-search-form svg {
  width: 20px;
  height: 20px;
}

.list-filter-details {
  position: relative;
  z-index: 20;
}

.list-filter-details > summary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .85rem;
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.list-filter-details > summary::-webkit-details-marker {
  display: none;
}

.list-filter-panel {
  position: absolute;
  top: calc(100% + .55rem);
  right: 0;
  width: min(680px, calc(100vw - 2rem));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  padding: .85rem;
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15,36,55,.16);
}

.list-filter-panel label {
  display: grid;
  gap: .28rem;
  color: #64748b;
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.list-filter-panel select,
.list-filter-panel input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  padding: .45rem .6rem;
  color: var(--brand-dark);
  font: inherit;
  font-weight: 700;
  text-transform: none;
}

.pro-table-wrap {
  overflow-x: auto;
  border: 1px solid #e1ece8;
  border-radius: 18px;
  background: #fff;
}

.pro-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.pro-table th,
.pro-table td {
  padding: .72rem .85rem;
  border-bottom: 1px solid #e7efec;
  text-align: left;
  vertical-align: middle;
}

.pro-table th {
  color: #64748b;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .025em;
  text-transform: uppercase;
  background: #f8fafc;
}

.pro-table tbody tr {
  cursor: pointer;
  transition: background .16s ease, box-shadow .16s ease;
}

.pro-table tbody tr:hover,
.pro-table tbody tr.is-selected {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 8%, #fff) 0%, #fff 100%);
}

.pro-table tbody tr.is-selected {
  box-shadow: inset 3px 0 0 var(--brand-primary);
}

.pro-table td strong,
.pro-table td small {
  display: block;
}

.pro-table td strong {
  color: var(--brand-dark);
  font-weight: 850;
}

.pro-table td small {
  margin-top: .18rem;
  color: #64748b;
  font-weight: 650;
}

.pro-thumb {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 11px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.pro-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pro-thumb svg {
  width: 26px;
  height: 26px;
  background: transparent;
}

.sex-mark {
  color: #64748b;
  font-weight: 900;
}

.sex-mark--hembra { color: #e8799b; }
.sex-mark--macho { color: #3b82f6; }

.check-pill,
.health-pill,
.species-pill,
.colony-status-pill {
  width: fit-content;
  max-width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .62rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 850;
  line-height: 1.1;
  white-space: nowrap;
}

.check-pill.is-ok,
.health-pill--healthy,
.species-pill {
  background: #eaf8ef;
  color: #13834f;
}

.check-pill.is-muted,
.health-pill--unknown {
  background: #f1f5f9;
  color: #64748b;
}

.health-pill--watch,
.health-pill--treatment {
  background: #fff7ed;
  color: #c2410c;
}

.health-pill--chronic {
  background: #f1f5f9;
  color: #475569;
}

.row-action-dots a {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #64748b;
  text-decoration: none;
}

.row-action-dots a:hover {
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.pro-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .45rem;
  flex-wrap: wrap;
  color: #64748b;
  font-weight: 800;
}

.pro-pagination [data-page-summary],
.pro-pagination [data-mobile-page-summary],
.pro-pagination [data-colonies-map-summary] {
  margin-right: .5rem;
}

.pager-pages {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: .18rem;
  border: 1px solid #d8e9e4;
  border-radius: 14px;
  background: #f8fcfa;
}

.pager-nav {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}

.pager-pages button,
.pager-arrow {
  min-width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #c9e2dc;
  border-radius: 12px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(15, 23, 42, .05);
}

.pager-ellipsis {
  min-width: 22px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  color: #64748b;
  font-weight: 900;
}

.pager-current-label {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .9rem;
  border: 1px solid #c9e2dc;
  border-radius: 12px;
  background: #fff;
  color: var(--brand-dark);
  font-size: .95rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 7px 18px rgba(15, 23, 42, .05);
}

.pager-arrow {
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--brand-primary);
}

.pager-pages button:hover,
.pager-arrow:hover {
  border-color: var(--brand-primary);
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.pager-pages button.is-active {
  border-color: var(--brand-primary);
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
  box-shadow: inset 0 0 0 1px rgba(19, 133, 112, .18);
}

.pager-arrow:disabled,
.pager-pages button:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

.pro-pagination label {
  margin-left: auto;
}

.pro-pagination select {
  min-height: 44px;
  min-width: 150px;
  padding: 0 2.2rem 0 .9rem;
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  background: #fff;
  color: var(--brand-dark);
  font-size: .95rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

@media (max-width: 820px) {
  .pro-pagination {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    justify-content: start;
    gap: .55rem .5rem;
    width: 100%;
  }

  .pro-pagination [data-page-summary],
  .pro-pagination [data-mobile-page-summary],
  .pro-pagination [data-colonies-map-summary] {
    grid-column: 1 / -1;
    margin-right: 0;
  }

  .pro-pagination .pager-nav {
    grid-column: 1 / -1;
    justify-self: start;
    max-width: 100%;
  }

  .pro-pagination .pager-pages {
    max-width: 100%;
    overflow: visible;
  }

  .pro-pagination label {
    grid-column: 1 / -1;
    margin-left: 0;
    width: 100%;
  }

  .pro-pagination select {
    width: 100%;
    min-width: 0;
  }
}

.cat-selection-card,
.colonies-list-detail {
  scroll-margin-top: 145px;
}

.cat-selection-card {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1.35fr) minmax(260px, .9fr) minmax(220px, .7fr);
  gap: 1rem;
  align-items: stretch;
  margin-top: 1rem;
}

/* La foto vive en posicionamiento absoluto dentro de su marco: así su tamaño
   intrínseco (p. ej. una foto vertical muy alta) nunca infla las filas del
   grid ni desborda sobre los botones. El marco toma su alto del área que le
   asigna el grid y la imagen simplemente lo rellena con object-fit: cover. */
.cat-selection-photo {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-primary-pale), #fff);
}

.cat-selection-photo__link {
  position: absolute;
  inset: 0;
  display: block;
  cursor: zoom-in;
}

.cat-selection-photo__link[hidden],
.cat-selection-photo img[hidden],
.cat-selection-photo__fallback[hidden] {
  display: none;
}

.cat-selection-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cat-selection-photo__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--brand-primary);
}

.cat-selection-main,
.cat-selection-notes,
.cat-selection-aside {
  min-width: 0;
}

.cat-selection-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
}

.cat-selection-title h2 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

.cat-selection-main > p {
  margin: .45rem 0 1rem;
  color: #64748b;
  font-weight: 750;
}

.cat-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem .9rem;
}

.cat-info-grid span {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: .42rem;
  color: #64748b;
  font-weight: 700;
  /* La etiqueta (p.ej. "Esterilizada/o") es un nodo de texto suelto sin
     envoltorio propio, así que el ajuste de línea debe fijarse aquí: la
     regla de overflow-wrap en .cat-info-grid strong no la alcanza. */
  overflow-wrap: anywhere;
}

.cat-info-grid strong {
  grid-column: 2;
  color: var(--brand-dark);
  font-weight: 850;
}

.cat-info-grid svg {
  width: 19px;
  height: 19px;
  color: var(--brand-primary);
  background: transparent;
}

.cat-selection-notes {
  display: grid;
  align-content: start;
  gap: .75rem;
}

.cat-selection-notes article {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: .7rem;
  padding: .8rem;
  border: 1px solid #e5ece9;
  border-radius: 16px;
  background: #fff;
}

.cat-selection-notes article > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.cat-selection-notes svg {
  width: 22px;
  height: 22px;
  background: transparent;
}

.cat-selection-notes strong {
  color: var(--brand-dark);
}

.cat-selection-notes p {
  margin: .2rem 0 0;
  color: #64748b;
  font-weight: 650;
  line-height: 1.45;
}

.cat-selection-aside {
  display: grid;
  gap: .65rem;
  align-content: start;
}

.health-summary {
  display: grid;
  gap: .25rem;
  padding: .8rem;
  border-radius: 16px;
  background: var(--brand-primary-pale);
}

.health-summary small {
  color: #64748b;
  font-weight: 650;
}

.cat-detail-next-review {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  margin: 0;
  color: var(--brand-dark);
  font-weight: 850;
  line-height: 1.12;
}

/* El display: flex anterior pisaba el atributo hidden del marcado y dejaba
   una caja vacía cuando el gato no tiene próxima revisión. */
.cat-detail-next-review[hidden] {
  display: none;
}

.cat-detail-next-review .app-icon,
.cat-detail-next-review svg {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  flex: 0 0 24px;
  color: var(--brand-primary);
  background: transparent;
}

.cat-detail-next-review strong {
  white-space: nowrap;
  word-break: keep-all;
}

/* Colonias: la tabla compacta se beneficia del mismo paginado visual. */
.colonies-compact-table-wrap {
  overflow-x: auto;
}

.colonies-compact-table {
  min-width: 980px;
}

.colonies-list-mode .pro-pagination {
  margin-top: -.2rem;
}

@media (max-width: 1180px) {
  .cat-selection-card {
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  }

  .cat-selection-notes,
  .cat-selection-aside {
    grid-column: span 1;
  }
}

@media (max-width: 820px) {
  .module-pro-head,
  .list-work-toolbar {
    display: grid;
  }

  .module-pro-actions,
  .list-work-controls,
  .list-search-form,
  .list-filter-details > summary {
    width: 100%;
  }

  .list-filter-panel {
    position: static;
    width: 100%;
    grid-template-columns: 1fr;
    margin-top: .55rem;
    box-shadow: none;
  }

  .pro-table {
    min-width: 0;
  }

  .cats-pro-table thead {
    display: none;
  }

  .cats-pro-table,
  .cats-pro-table tbody,
  .cats-pro-table tr,
  .cats-pro-table td {
    display: block;
    width: 100%;
  }

  .cats-pro-table tbody {
    display: grid;
    gap: .75rem;
  }

  .cats-pro-table tr {
    padding: .75rem;
    border: 1px solid var(--brand-border);
    border-radius: 18px;
    background: #fff;
  }

  .cats-pro-table td {
    padding: .35rem 0;
    border: 0;
  }

  .cats-pro-table td:nth-child(1) {
    float: left;
    width: 64px;
    margin-right: .75rem;
  }

  .cats-pro-table td:nth-child(2) {
    min-height: 62px;
  }

  .cats-pro-table td:nth-child(n+3):nth-child(-n+7) {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    clear: both;
  }

  .cats-pro-table td:nth-child(3)::before { content: "Sexo"; }
  .cats-pro-table td:nth-child(4)::before { content: "Esterilizada/o"; }
  .cats-pro-table td:nth-child(5)::before { content: "Chip"; }
  .cats-pro-table td:nth-child(6)::before { content: "Salud"; }
  .cats-pro-table td:nth-child(7)::before { content: "Revisión"; }

  .cats-pro-table td::before {
    color: #64748b;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .02em;
    text-transform: uppercase;
  }

  .cats-pro-table td:nth-child(8) {
    display: none;
  }

  .cat-selection-card {
    grid-template-columns: 1fr;
  }

  .cat-selection-photo {
    min-height: 210px;
  }

  .cat-info-grid {
    grid-template-columns: 1fr;
  }

  .pro-pagination {
    justify-content: flex-start;
  }
}

/* Listados paginados horizontalmente */
.pro-table tr.is-page-hidden,
.colonies-compact-table tr.is-page-hidden,
.cats-pro-table tr.is-page-hidden,
[data-page-row].is-page-hidden {
  display: none;
}

/* Ficha seleccionada encima del listado */
.cats-workspace .cat-selection-card {
  margin-top: 0;
  margin-bottom: .9rem;
  order: 1;
}

.cats-workspace .pro-table-wrap {
  order: 2;
}

.cats-workspace .pro-pagination {
  order: 3;
}

.colonies-list-mode .colonies-list-detail {
  order: 2;
  margin-bottom: .2rem;
}

.colonies-list-mode .pro-pagination {
  order: 4;
}

/* Controles superiores alineados */
.list-work-toolbar {
  align-items: flex-start;
}

.list-work-controls {
  flex: 1 1 520px;
  min-width: min(100%, 360px);
}

.list-search-form {
  flex: 1 1 360px;
  max-width: 620px;
}

.list-filter-details {
  flex: 0 0 auto;
}

.list-filter-details > summary {
  white-space: nowrap;
}

.list-filter-details > summary .app-icon,
.list-filter-details > summary svg,
.list-search-form button .app-icon,
.list-search-form button svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  max-width: 20px;
  flex: 0 0 20px;
  background: transparent;
}

.module-pro-title .breadcrumbs,
.module-pro-title .mini-breadcrumbs {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}

@media (min-width: 1100px) {
  .list-work-toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(420px, .95fr);
  }
}

@media (max-width: 820px) {
  .cats-workspace .cat-selection-card,
  .colonies-list-mode .colonies-list-detail {
    order: 1;
  }

  .cats-workspace .pro-table-wrap,
  .colonies-list-mode .colonies-compact-table-wrap {
    order: 2;
  }

  .cats-workspace .pro-pagination,
  .colonies-list-mode .pro-pagination {
    order: 3;
  }
}

/* Módulo Gatos: layout consolidado */
.cats-workspace .list-work-card {
  display: grid;
  gap: 1rem;
  overflow: visible;
}

.cats-workspace .list-work-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.cats-workspace .list-work-controls {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: .75rem;
  flex: 1 1 520px;
  min-width: min(100%, 320px);
}

.cats-workspace .list-search-form {
  flex: 1 1 360px;
  max-width: 620px;
  min-width: min(100%, 260px);
  display: flex;
  align-items: center;
  gap: .35rem;
}

.cats-workspace .list-search-form input {
  min-width: 0;
}

.cats-workspace .list-search-form button,
.cats-workspace .list-filter-details > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 44px;
  border-radius: 14px;
}

.cats-workspace .list-search-form button .app-icon,
.cats-workspace .list-filter-details > summary .app-icon,
.cats-workspace .list-search-form button svg,
.cats-workspace .list-filter-details > summary svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.cats-workspace .list-filter-details {
  position: relative;
  flex: 0 0 auto;
  z-index: 20;
}

.cats-workspace .list-filter-details > summary {
  list-style: none;
  cursor: pointer;
  padding: .55rem .85rem;
  border: 1px solid var(--brand-border);
  background: #fff;
  color: var(--brand-dark);
  font-weight: 850;
  white-space: nowrap;
}

.cats-workspace .list-filter-details > summary::-webkit-details-marker {
  display: none;
}

.cats-workspace .list-filter-panel {
  position: absolute;
  top: calc(100% + .55rem);
  right: 0;
  z-index: 30;
  width: min(720px, calc(100vw - 2rem));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  padding: .85rem;
  border: 1px solid var(--brand-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15,36,55,.16);
}

.cats-workspace .list-filter-panel label {
  display: grid;
  gap: .3rem;
  color: #64748b;
  font-weight: 800;
}

.cats-workspace .list-filter-panel select,
.cats-workspace .list-filter-panel input {
  width: 100%;
}

.cats-workspace .cat-selection-card {
  order: 1;
  margin: 0;
  display: grid;
}

.cats-workspace .pro-table-wrap {
  order: 2;
  overflow-x: auto;
  max-width: 100%;
}

.cats-workspace .cats-pro-table {
  width: 100%;
  min-width: 980px;
}

.cats-workspace .cat-selection-photo {
  min-height: 250px;
}

@media (max-width: 820px) {
  .cats-workspace .list-work-toolbar,
  .cats-workspace .list-work-controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .cats-workspace .list-search-form {
    max-width: none;
    width: 100%;
  }

  .cats-workspace .list-filter-details,
  .cats-workspace .list-filter-details > summary {
    width: 100%;
  }

  .cats-workspace .list-filter-panel {
    position: static;
    width: 100%;
    grid-template-columns: 1fr;
    margin-top: .65rem;
    box-shadow: none;
  }

  .cats-workspace .cats-pro-table {
    min-width: 0;
  }

  .cats-workspace .pro-table-wrap {
    overflow: visible;
  }
}

/* Gatos · ficha seleccionada compacta */
.cats-workspace .cat-selection-card {
  grid-template-columns: 220px minmax(0, 1fr) minmax(0, .95fr);
  grid-template-areas:
    "photo main main"
    "photo details details"
    "photo notes notes"
    "photo aside aside";
  gap: .85rem 1rem;
  align-items: start;
}

/* El marco de la foto se estira a las filas que le asigna el área "photo"
   de cada breakpoint (4 filas en pantallas anchas, 3 en intermedias). No se
   fija grid-row a mano: hacerlo rompía el layout cuando la media query de
   1280px reservaba la última fila para los botones. El alto lo dicta el
   contenido vecino, no la imagen (en absoluto, fuera del cálculo del grid). */
.cats-workspace .cat-selection-photo {
  grid-area: photo;
  align-self: stretch;
}

.cats-workspace .cat-selection-main {
  grid-area: main;
  display: grid;
  align-content: start;
  gap: .42rem;
}

.cats-workspace .cat-selection-main > p {
  margin: 0 0 .15rem;
}

.cats-workspace .cat-info-grid {
  grid-area: details;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem .9rem;
}

.cats-workspace .cat-selection-notes {
  grid-area: notes;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}

.cats-workspace .cat-selection-notes article {
  min-height: 0;
  padding: .9rem 1rem;
}

/* Sin grid-area propia, esta sección cae en una fila implícita y ocupa solo
   la primera columna (la de la foto), dejando los adjuntos apretados en una
   franja estrecha. Debe abarcar todas las columnas en cualquier breakpoint. */
.cats-workspace .cat-selection-card .cat-detail-vet-docs {
  grid-column: 1 / -1;
}

.cats-workspace .cat-selection-aside {
  display: grid;
  grid-area: aside;
  grid-template-columns: minmax(210px, .92fr) repeat(3, minmax(0, 1fr));
  gap: .75rem;
  align-content: stretch;
  align-items: stretch;
}

.cats-workspace .cat-selection-aside .health-summary {
  height: 100%;
  align-content: center;
}

.cats-workspace .cat-selection-aside .colonies-list-action {
  min-height: 100%;
  display: flex;
  align-items: center;
}

@media (max-width: 1280px) {
  .cats-workspace .cat-selection-card {
    grid-template-columns: minmax(170px, 230px) minmax(0, 1fr);
    grid-template-areas:
      "photo main"
      "photo details"
      "photo notes"
      "aside aside";
  }

  .cats-workspace .cat-selection-notes {
    grid-column: auto;
  }

  .cats-workspace .cat-selection-aside {
    grid-column: auto;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
}

@media (max-width: 820px) {
  .cats-workspace .cat-selection-card {
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas:
      "photo main"
      "details details"
      "notes notes"
      "aside aside";
    gap: .72rem;
    padding: .85rem;
  }

  .cats-workspace .cat-selection-photo {
    grid-area: photo;
    align-self: start;
    min-height: 96px;
    height: 96px;
    border-radius: 18px;
  }

  .cats-workspace .cat-selection-main {
    grid-area: main;
    display: grid;
    gap: .42rem;
    align-content: start;
  }

  .cats-workspace .cat-selection-title {
    gap: .38rem;
  }

  .cats-workspace .cat-selection-title h2 {
    font-size: clamp(1.35rem, 7vw, 1.85rem);
    line-height: 1.03;
  }

  .cats-workspace .cat-selection-main > p {
    margin: 0;
    font-size: .9rem;
    line-height: 1.16;
  }

  .cats-workspace .cat-info-grid {
    grid-area: details;
    grid-column: 1 / -1;
    /* Minimo de columna calculado para que el texto nunca se parta letra a
       letra (overflow-wrap:anywhere): con icono de 46px + gap + padding,
       quedan ~94px de texto, suficientes para "20/05/2026" (~73px) y
       "Esterilizada/o" (~78px). Si se cambia el tamaño del icono o el
       padding, recalcular este minimo. */
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .42rem;
  }

  .cats-workspace .cat-info-grid span {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: .24rem .42rem;
    min-width: 0;
    padding: .48rem .52rem;
    border: 1px solid #e5ece9;
    border-radius: 13px;
    background: linear-gradient(135deg, #fff 0%, #f8fdfb 100%);
    font-size: .7rem;
    line-height: 1.05;
  }

  .cats-workspace .cat-info-grid strong {
    font-size: .86rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  .cats-workspace .cat-info-grid svg,
  .cats-workspace .cat-info-grid .app-icon {
    grid-row: 1 / span 2;
    width: 46px;
    height: 46px;
  }

  .cats-workspace .cat-selection-notes {
    grid-area: notes;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .48rem;
  }

  .cats-workspace .cat-selection-notes article {
    /* La columna del icono debe medir 48px: el span recibe ese tamaño real
       desde la regla compartida de iconos en pastilla (línea ~11990), no
       desde los 34/42px declarados aquí, o el icono se desborda sobre el texto. */
    grid-template-columns: 48px minmax(0, 1fr);
    gap: .48rem;
    padding: .58rem;
    border-radius: 14px;
  }

  .cats-workspace .cat-selection-notes article > span {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .cats-workspace .cat-selection-notes p {
    margin-top: .08rem;
    font-size: .86rem;
    line-height: 1.18;
  }

  .cats-workspace .cat-selection-aside {
    grid-area: aside;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
    gap: .42rem;
  }

  .cats-workspace .cat-detail-next-review {
    grid-column: 1 / -1;
    min-height: 54px;
    padding: .52rem .6rem;
    border: 1px solid #e5ece9;
    border-radius: 14px;
    background: linear-gradient(135deg, #fff 0%, #f8fdfb 100%);
    flex-wrap: wrap;
  }

  .cats-workspace .health-summary {
    min-height: 0;
    padding: .55rem;
    border-radius: 14px;
  }

  .cats-workspace .health-summary small {
    font-size: .72rem;
    line-height: 1.1;
  }

  .cats-workspace .cat-selection-aside .colonies-list-action {
    min-height: 36px;
    padding: .48rem .55rem;
    border-radius: 13px;
    font-size: .82rem;
    line-height: 1.05;
  }
}

/* =========================================================
   Salud clínica · módulo veterinario
   ========================================================= */
.clinical-page,
.cat-clinical-section {
  display: grid;
  gap: 1rem;
}

.clinical-head {
  margin-bottom: .25rem;
}

.clinical-date {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #64748b;
  font-weight: 800;
}

.clinical-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
}

.clinical-kpi {
  min-height: 0;
  display: grid;
  align-items: center;
  column-gap: .65rem;
  row-gap: .15rem;
  padding: .72rem .85rem;
  border: 1px solid #e5ece9;
  border-radius: 14px;
  background: #fff;
}

.clinical-kpi > span {
  border-radius: 0;
  background: transparent;
  color: var(--brand-primary);
}

.clinical-kpi strong {
  display: block;
  color: var(--brand-dark);
  line-height: 1;
  white-space: nowrap;
}

.clinical-kpi small {
  display: block;
  margin-top: 0;
  color: #64748b;
  font-weight: 750;
  line-height: 1.15;
  text-align: left;
  text-wrap: balance;
}

.clinical-kpi--green { background: linear-gradient(135deg, #fff, #f0fdf4); }
.clinical-kpi--orange { background: linear-gradient(135deg, #fff, #fff7ed); }
.clinical-kpi--blue { background: linear-gradient(135deg, #fff, #eff6ff); }
.clinical-kpi--red { background: linear-gradient(135deg, #fff, #fff1f2); }

.clinical-board {
  display: grid;
  gap: 1rem;
  align-items: start;
  grid-template-columns: minmax(680px, 1.32fr) minmax(360px, .68fr);
}

.clinical-patients,
.clinical-detail {
  min-width: 0;
}

.clinical-patients {
  display: grid;
  gap: .8rem;
}

.clinical-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(145px, .65fr) minmax(145px, .65fr);
  gap: .6rem;
}

.clinical-filters input,
.clinical-filters select {
  width: 100%;
  min-height: 40px;
  padding: .55rem .7rem;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 750;
}

.clinical-table-wrap {
  min-width: 0;
  max-height: 560px;
  overflow: auto;
  border: 1px solid #e5ece9;
  border-radius: 16px;
}

.clinical-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.clinical-table th,
.clinical-table td {
  padding: .72rem .75rem;
  border-bottom: 1px solid #eef2f1;
  text-align: left;
  vertical-align: middle;
}

.clinical-table th:last-child,
.clinical-table td:last-child {
  padding-right: 1rem;
}

.clinical-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  color: #64748b;
  font-size: .75rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.clinical-table tbody tr {
  cursor: pointer;
}

.clinical-table tbody tr:hover,
.clinical-table tbody tr.is-selected {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 8%, #fff), #fff);
}

.clinical-table tbody tr.is-selected {
  box-shadow: inset 3px 0 0 var(--brand-primary);
}

.clinical-table td:last-child .clinical-status {
  max-width: 100%;
  box-sizing: border-box;
  justify-content: center;
  margin-inline: auto;
}

.clinical-patient {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: .55rem;
  align-items: center;
  min-width: 150px;
}

.clinical-patient-photo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.clinical-patient-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Salud móvil: ficha primero y pacientes paginados */
@media (max-width: 720px) {
  .clinical-patients .widget-head p {
    max-width: 100%;
    text-wrap: pretty;
  }

  .clinical-patients .clinical-table {
    background: transparent;
  }

  .clinical-patients .clinical-table thead {
    display: none;
  }

  .clinical-patients .clinical-table tr {
    align-content: start ;
    min-height: 0;
  }

  .clinical-patients .clinical-table tr.is-selected {
    border-color: color-mix(in srgb, var(--brand-primary) 46%, #e5ece9);
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand-primary) 8%, #fff), #fff);
    box-shadow: 0 14px 30px rgba(8, 122, 104, .13);
  }

  .clinical-patients .clinical-table tr.is-page-hidden,
  .clinical-patients .clinical-table tr.is-filtered-out,
  .clinical-patients .clinical-table tr[hidden] {
    display: none;
  }

  .clinical-patients .clinical-table td:nth-child(3)::before,
  .clinical-patients .clinical-table td:nth-child(4)::before {
    display: block;
    margin-bottom: .16rem;
    color: #64748b;
    font-size: .68rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .02em;
  }

  .clinical-patients .clinical-table td:nth-child(3)::before {
    content: "Próxima cita";
  }

  .clinical-patients .clinical-table td:nth-child(4)::before {
    content: "Estado";
  }

  .clinical-patient,
  .clinical-case {
    min-width: 0;
  }

  .clinical-pagination {
    margin-top: .1rem;
  }

  .clinical-pagination .pager-pages {
    max-width: 100%;
    overflow-x: auto;
  }
}

/* KPIs clínicas: layout definitivo */
.clinical-kpi {
  grid-template-columns: 54px minmax(0, 1fr);
  justify-items: stretch ;
}

.clinical-kpi > span {
  grid-row: 1 / span 2;
  justify-self: center ;
  align-self: center;
}

.clinical-kpi strong,
.clinical-kpi small {
  grid-column: 2;
  justify-self: center ;
  width: 100%;
  min-width: 0;
  text-align: center;
}

.clinical-kpi strong {
  align-self: end;
}

.clinical-kpi small {
  align-self: start;
  max-width: 13.5ch;
  margin-inline: auto ;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  text-wrap: balance;
}

@media (max-width: 720px) {
  .clinical-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .58rem;
  }

  .clinical-kpi {
    min-height: 78px;
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: .42rem ;
    padding: .58rem .56rem;
  }

  .clinical-kpi > span {
    width: 38px;
    height: 38px;
  }

  .clinical-kpi strong {
    font-size: 1.28rem;
    line-height: 1;
  }

  .clinical-kpi small {
    max-width: 11.5ch;
    font-size: .78rem;
    line-height: 1.12;
  }
}

@media (max-width: 360px) {
  .clinical-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clinical-kpi {
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: .34rem ;
    padding: .52rem .42rem;
  }

  .clinical-kpi > span {
    width: 32px;
    height: 32px;
  }

  .clinical-kpi strong {
    font-size: 1.12rem;
  }

  .clinical-kpi small {
    max-width: 10.5ch;
    font-size: .7rem;
  }
}

/* Carrusel móvil reutilizable para listados largos */
.mobile-carousel-pagination {
  display: none;
}

@media (max-width: 720px) {
  .app-main .table-wrap:has(> table.mobile-carousel-table) {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding-bottom: .35rem;
  }

  .app-main table.table.mobile-carousel-table.responsive-list-table,
  .app-main .table-wrap > table.table.mobile-carousel-table.responsive-list-table {
    width: 100%;
    max-width: none;
    border-spacing: 0;
  }

  .app-main table.table.mobile-carousel-table.responsive-list-table tbody {
    display: flex;
    gap: .72rem;
    width: fit-content;
    min-width: 0;
  }

  .app-main table.table.mobile-carousel-table.responsive-list-table tr.mobile-carousel-row {
    flex: 0 0 calc(100vw - 2.25rem);
    width: auto;
    max-width: 440px;
    margin: 0;
    scroll-snap-align: start;
  }

  .app-main table.table.mobile-carousel-table.responsive-list-table tr.mobile-carousel-row.is-page-hidden {
    display: none;
  }

  .app-main table.table.mobile-carousel-table.responsive-list-table td {
    grid-template-columns: minmax(6.6rem, 34%) minmax(0, 1fr);
    gap: .48rem;
  }

  .mobile-carousel-pagination {
    display: flex;
    margin-top: .45rem;
  }

  .mobile-carousel-pagination[hidden] {
    display: none;
  }

  .cats-workspace .pro-table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding: .85rem .85rem .7rem;
    border: 1px solid #c9e2dc;
    border-radius: 22px;
    background:
      linear-gradient(90deg, rgba(19, 133, 112, .12), transparent 1.1rem) left top / 1.1rem 100% no-repeat,
      linear-gradient(180deg, #f2fbf8 0%, #ffffff 72%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .75);
  }

  .cats-workspace .cats-pro-table tbody {
    display: flex;
    gap: .72rem;
    width: 100%;
    min-width: 0;
  }

  .cats-workspace .cats-pro-table tr {
    flex: 0 0 100%;
    max-width: 440px;
    margin: 0;
    scroll-snap-align: start;
    border-color: #b9d8d1;
    box-shadow: 0 12px 24px rgba(15, 23, 42, .07);
  }

  .cats-workspace .cats-pro-table tr.is-page-hidden {
    display: none;
  }

  .cats-workspace .cats-pro-table tr.is-selected {
    border-color: var(--brand-primary);
    box-shadow: inset .28rem 0 0 var(--brand-primary), 0 14px 26px rgba(15, 118, 110, .13);
  }

  .cats-workspace .pro-pagination {
    margin-top: .7rem;
    padding: .7rem .85rem;
    border: 1px solid #dbe8e4;
    border-radius: 20px;
    background: #f7fbf9;
  }
}

.clinical-patient strong,
.clinical-patient small {
  display: block;
  min-width: 0;
}

.clinical-patient small {
  color: #64748b;
  font-size: .76rem;
  font-weight: 700;
}

/* Reportes e incidencias · ficha de seguimiento */
.incident-detail-shell {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #b8d9d2;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfa 100%);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .05);
}

.incident-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 1rem;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e1ebe8;
}

.incident-title-block {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.incident-detail-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 2px solid var(--brand-dark);
  border-radius: 12px;
  background: #fff8ed;
  color: var(--brand-dark);
}

.incident-detail-icon svg,
.incident-detail-icon img,
.incident-detail-icon .app-icon,
.incident-detail-icon .app-illustrated-icon,
.incident-detail-icon .app-generated-icon {
  width: 30px;
  height: 30px;
  max-width: 30px;
  max-height: 30px;
  flex: 0 0 30px;
  padding: 0;
  border-radius: 8px;
  clip-path: inset(0 round 8px);
  object-fit: contain;
  background: transparent;
}

.incident-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
  margin-bottom: .55rem;
  color: #64748b;
  font-weight: 750;
  font-size: .86rem;
}

.incident-breadcrumb a {
  color: #64748b;
  text-decoration: none;
}

.incident-kicker {
  margin: 0 0 .2rem;
  color: #64748b;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.incident-title-block h2 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.incident-title-block p:last-child {
  margin: .55rem 0 0;
  color: #42526b;
  font-weight: 650;
  line-height: 1.45;
}

.incident-status-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: .8rem;
  align-items: center;
  padding: 1rem;
  border-radius: 18px;
  background: #ecfdf5;
  color: #0f766e;
}

.incident-status-card > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fff;
}

.incident-status-card svg,
.incident-status-card img,
.incident-status-card .app-icon,
.incident-status-card .app-illustrated-icon,
.incident-status-card .app-generated-icon {
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
  flex: 0 0 22px;
  padding: 0;
  border-radius: 6px;
  clip-path: inset(0 round 6px);
  object-fit: contain;
  background: transparent;
}

.incident-status-card strong,
.incident-status-card small,
.incident-status-card em {
  display: block;
}

.incident-status-card small {
  margin-top: .2rem;
  color: #64748b;
  font-weight: 700;
}

.incident-status-card em {
  margin-top: .35rem;
  color: #42526b;
  font-style: normal;
  font-weight: 750;
  line-height: 1.25;
}

.incident-status-card.status-abierto,
.incident-status-card.status-en_revision {
  background: #eff6ff;
  color: #2563eb;
}

.incident-status-card.status-en_curso {
  background: #fff7ed;
  color: #c2410c;
}

.incident-status-card.status-rechazado {
  background: #fef2f2;
  color: #991b1b;
}

.incident-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .8fr);
  gap: 1rem;
}

.incident-media-card {
  min-height: 330px;
  overflow: hidden;
  border: 1px solid #dce9e5;
  border-radius: 18px;
  background: #f8fcfa;
}

.incident-media-card a,
.incident-media-card img {
  display: block;
  width: 100%;
  height: 100%;
}

.incident-media-card [hidden] {
  display: none;
}

.incident-media-card img {
  min-height: 330px;
  object-fit: cover;
}

.incident-media-fallback {
  min-height: 330px;
  display: grid;
  place-items: center;
  gap: .5rem;
  color: #64748b;
  font-weight: 800;
}

.incident-media-fallback svg {
  width: 54px;
  height: 54px;
  color: var(--brand-primary);
  background: transparent;
}

.incident-facts-card,
.incident-summary-card,
.incident-history-card,
.incident-manage-card {
  padding: 1rem;
  border: 1px solid #dce9e5;
  border-radius: 18px;
  background: #fff;
}

.incident-facts-card h3,
.incident-summary-card h3,
.incident-history-card h3,
.incident-manage-card h3 {
  margin: 0 0 .9rem;
  color: var(--brand-dark);
}

.incident-facts-card dl {
  display: grid;
  gap: .85rem;
  margin: 0;
}

.incident-facts-card dl > div {
  display: grid;
  grid-template-columns: minmax(120px, .75fr) minmax(0, 1fr);
  gap: .8rem;
  align-items: start;
}

.incident-facts-card dt {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  color: #64748b;
  font-weight: 850;
}

.incident-facts-card dt svg,
.incident-facts-card dt img,
.incident-facts-card dt .app-icon,
.incident-facts-card dt .app-illustrated-icon,
.incident-facts-card dt .app-generated-icon {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex: 0 0 18px;
  padding: 0;
  color: var(--brand-primary);
  background: transparent;
}

.incident-facts-card dd {
  margin: 0;
  color: var(--brand-dark);
  font-weight: 750;
}

.incident-admin-note {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e1ebe8;
}

.incident-admin-note p {
  margin: .35rem 0 0;
  color: #42526b;
  line-height: 1.45;
}

.incident-workflow-help {
  margin-bottom: 1rem;
  padding: .85rem;
  border: 1px solid #dce9e5;
  border-radius: 16px;
  background: #f7fcfa;
}

.incident-workflow-help strong {
  display: block;
  margin-bottom: .65rem;
  color: var(--brand-dark);
}

.incident-workflow-help ol {
  display: grid;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: incident-flow;
}

.incident-workflow-help li {
  display: grid;
  grid-template-columns: 28px minmax(0, .75fr) minmax(0, 1fr);
  gap: .5rem;
  align-items: center;
  color: #42526b;
}

.incident-workflow-help li::before {
  counter-increment: incident-flow;
  content: counter(incident-flow);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e7f6f1;
  color: var(--brand-primary);
  font-size: .78rem;
  font-weight: 900;
}

.incident-workflow-help span {
  color: var(--brand-dark);
  font-weight: 850;
}

.incident-workflow-help small {
  color: #64748b;
  font-weight: 700;
  line-height: 1.25;
}

.incident-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(340px, 1fr) minmax(320px, .9fr);
  gap: 1rem;
  align-items: start;
}

.incident-summary-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.incident-summary-kpis article {
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: .45rem;
  padding: .9rem;
  border: 1px solid #e1ebe8;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff 0%, #f8fcfa 100%);
}

.incident-summary-kpis span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.incident-summary-kpis svg,
.incident-summary-kpis img,
.incident-summary-kpis .app-icon,
.incident-summary-kpis .app-illustrated-icon,
.incident-summary-kpis .app-generated-icon {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  flex: 0 0 28px;
  padding: 0;
  border-radius: 8px;
  clip-path: inset(0 round 8px);
  object-fit: contain;
  background: transparent;
}

.incident-summary-kpis small {
  color: #64748b;
  font-weight: 800;
}

.incident-summary-kpis strong {
  color: var(--brand-dark);
  font-size: 1.25rem;
  line-height: 1.15;
}

.incident-history-list {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-left: .25rem;
}

.incident-history-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: .65rem;
}

.incident-history-item::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 34px;
  bottom: -1rem;
  width: 3px;
  border-radius: 999px;
  background: #b8d9d2;
}

.incident-history-item:last-child::before {
  display: none;
}

.incident-history-item > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 3px solid var(--brand-primary);
  border-radius: 999px;
  background: #fff;
}

.incident-history-item.is-done > span {
  background: var(--brand-primary);
}

.incident-history-item.is-done > span::before {
  content: "✓";
  color: #fff;
  font-weight: 900;
}

.incident-history-item.is-active > span::before,
.incident-history-item.is-pending > span::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--brand-primary);
}

.incident-history-item.is-pending > span {
  border-style: dashed;
}

.incident-history-item strong,
.incident-history-item time,
.incident-history-item p {
  display: block;
}

.incident-history-item strong {
  color: var(--brand-dark);
  font-size: 1.02rem;
}

.incident-history-item time {
  margin-top: .15rem;
  color: #64748b;
  font-weight: 750;
}

.incident-history-item p {
  margin: .25rem 0 0;
  color: #42526b;
  line-height: 1.35;
}

.requests-table tr[data-request-row] {
  cursor: pointer;
}

.requests-table tr[data-request-row]:hover td,
.requests-table tr.is-selected td {
  background: #f2fbf8;
}

.requests-table tr.is-selected td:first-child {
  box-shadow: inset 4px 0 0 var(--brand-primary);
}

.request-detail-shell {
  margin-bottom: 1rem;
}

.request-detail-main-grid {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
}

.request-detail-main-grid.has-no-photo {
  grid-template-columns: 1fr;
}

.request-media-card {
  min-height: 220px;
  align-self: start;
}

.request-media-card img {
  min-height: 220px;
}

.request-media-card .incident-media-fallback {
  min-height: 140px;
}

.request-media-card.is-empty {
  display: none;
}

.request-detail-shell .incident-facts-card {
  padding: .9rem;
}

.request-detail-shell .incident-facts-card h3 {
  margin-bottom: .7rem;
}

.request-detail-shell .incident-facts-card dl {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
}

.request-detail-shell .incident-facts-card dl > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: .45rem;
  padding: .75rem;
  border: 1px solid #e1ebe8;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfa 100%);
}

.request-detail-shell .incident-facts-card dt {
  gap: .48rem;
  font-size: .86rem;
  line-height: 1.15;
  white-space: normal;
}

.request-detail-shell .incident-facts-card dt svg,
.request-detail-shell .incident-facts-card dt img,
.request-detail-shell .incident-facts-card dt .app-icon,
.request-detail-shell .incident-facts-card dt .app-illustrated-icon,
.request-detail-shell .incident-facts-card dt .app-generated-icon,
.status-report-detail-shell .incident-facts-card dt svg,
.status-report-detail-shell .incident-facts-card dt img,
.status-report-detail-shell .incident-facts-card dt .app-icon,
.status-report-detail-shell .incident-facts-card dt .app-illustrated-icon,
.status-report-detail-shell .incident-facts-card dt .app-generated-icon {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  flex-basis: 24px;
  border-radius: 7px;
  clip-path: inset(0 round 7px);
  object-fit: contain;
}

.request-detail-shell .incident-facts-card dd {
  min-width: 0;
  font-size: 1.02rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.request-detail-shell .incident-admin-note {
  margin-top: .75rem;
  padding: .75rem;
  border: 1px solid #e1ebe8;
  border-radius: 14px;
  background: #f8fcfa;
}

.status-report-detail-shell .incident-detail-grid {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
}

.status-report-detail-shell .incident-media-card {
  min-height: 220px;
  align-self: start;
}

.status-report-detail-shell .incident-media-card img,
.status-report-detail-shell .incident-media-fallback {
  min-height: 220px;
}

.status-report-detail-shell .incident-facts-card {
  padding: .9rem;
}

.status-report-detail-shell .incident-facts-card h3 {
  margin-bottom: .7rem;
}

.status-report-detail-shell .incident-facts-card dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}

.status-report-detail-shell .incident-facts-card dl > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: .45rem;
  padding: .75rem;
  border: 1px solid #e1ebe8;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfa 100%);
}

.status-report-detail-shell .incident-facts-card dt {
  gap: .48rem;
  font-size: .86rem;
  line-height: 1.15;
  white-space: normal;
}

.status-report-detail-shell .incident-facts-card dd {
  min-width: 0;
  font-size: 1.02rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.status-report-detail-shell .incident-lower-grid {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr) minmax(300px, .9fr);
}

.colony-detail-hero,
.colony-detail-overview {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.colony-detail-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  padding: 1rem;
  border: 1px solid #b8d9d2;
  border-radius: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fcfa 100%);
  box-shadow: 0 16px 38px rgba(15, 23, 42, .05);
}

.colony-detail-main {
  display: grid;
  gap: .8rem;
}

.colony-detail-heading {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: .85rem;
  align-items: start;
}

.colony-detail-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.colony-detail-icon svg,
.colony-detail-icon img,
.colony-detail-icon .app-icon,
.colony-detail-icon .app-illustrated-icon,
.colony-detail-icon .app-generated-icon,
.colony-detail-meta svg,
.colony-detail-meta img,
.colony-detail-meta .app-icon,
.colony-detail-meta .app-illustrated-icon,
.colony-detail-meta .app-generated-icon,
.colony-detail-kpi svg,
.colony-detail-kpi img,
.colony-detail-kpi .app-icon,
.colony-detail-kpi .app-illustrated-icon,
.colony-detail-kpi .app-generated-icon {
  background: transparent;
}

.colony-detail-icon svg,
.colony-detail-icon img,
.colony-detail-icon .app-icon,
.colony-detail-icon .app-illustrated-icon,
.colony-detail-icon .app-generated-icon {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  flex: 0 0 28px;
  padding: 0;
  border-radius: 8px;
  clip-path: inset(0 round 8px);
  object-fit: contain;
}

.colony-detail-kpi > span svg,
.colony-detail-kpi > span img,
.colony-detail-kpi > span .app-icon,
.colony-detail-kpi > span .app-illustrated-icon,
.colony-detail-kpi > span .app-generated-icon {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  flex: 0 0 24px;
  padding: 0;
  border-radius: 7px;
  clip-path: inset(0 round 7px);
  object-fit: contain;
}

.colony-detail-heading .eyebrow {
  margin: 0 0 .15rem;
  color: #64748b;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.colony-detail-heading h1 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.colony-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .7rem;
  align-items: center;
  margin-top: .5rem;
  color: #64748b;
  font-weight: 800;
}

.colony-detail-meta span {
  display: inline-flex;
  gap: .35rem;
  align-items: center;
}

.colony-detail-meta svg,
.colony-detail-meta img,
.colony-detail-meta .app-icon,
.colony-detail-meta .app-illustrated-icon,
.colony-detail-meta .app-generated-icon {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex: 0 0 18px;
  padding: 0;
  border-radius: 5px;
  clip-path: inset(0 round 5px);
  object-fit: contain;
  color: var(--brand-primary);
}

.colony-detail-notes {
  max-width: 820px;
  padding: .75rem .85rem;
  border: 1px solid #e1ebe8;
  border-radius: 16px;
  background: #fff;
}

.colony-detail-notes strong {
  display: block;
  color: var(--brand-dark);
  font-size: .88rem;
}

.colony-detail-notes p {
  margin: .2rem 0 0;
  color: #42526b;
  font-weight: 650;
  line-height: 1.35;
}

.colony-detail-actions {
  min-width: 190px;
  justify-content: end;
}

.colony-detail-overview {
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr);
  align-items: stretch;
}

.colony-detail-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.colony-detail-kpi {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: .55rem;
  align-items: center;
  padding: .75rem;
  border: 1px solid #b8d9d2;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfa 100%);
}

.colony-detail-kpi > span {
  grid-row: span 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.colony-detail-kpi strong {
  color: var(--brand-primary);
  font-size: 1.25rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.colony-detail-kpi small {
  color: #64748b;
  font-weight: 850;
  line-height: 1.15;
}

.colony-photo-strip {
  min-width: 0;
  padding: .85rem;
  border: 1px solid #b8d9d2;
  border-radius: 18px;
  background: #fff;
}

.colony-photo-strip .widget-head {
  margin-bottom: .65rem;
}

.colony-photo-strip-list {
  display: grid;
  gap: .55rem;
  max-height: 280px;
  overflow: auto;
}

.colony-photo-chip {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: .6rem;
  align-items: center;
  padding: .45rem;
  border: 1px solid #e1ebe8;
  border-radius: 14px;
  background: #f8fcfa;
}

.colony-photo-chip img {
  width: 72px;
  height: 54px;
  display: block;
  border-radius: 10px;
  object-fit: cover;
}

.colony-photo-chip strong,
.colony-photo-chip small {
  display: block;
}

.colony-photo-chip strong {
  color: var(--brand-dark);
  font-size: .88rem;
  line-height: 1.15;
}

.colony-photo-chip small {
  margin-top: .15rem;
  color: #64748b;
  font-weight: 700;
}

.colony-photo-chip .photo-card-delete {
  margin: 0;
}

.colony-photo-chip .btn-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #f3c7cf;
  border-radius: 10px;
  background: #fff1f2;
  color: #be123c;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.compact-uploader {
  position: relative;
}

.compact-uploader form {
  position: absolute;
  z-index: 5;
  right: 0;
  top: calc(100% + .5rem);
  width: min(360px, 86vw);
  padding: .8rem;
  border: 1px solid #b8d9d2;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15,23,42,.16);
}

.colony-feeding-panel {
  padding: .95rem;
}

.colony-feeding-panel .widget-head {
  margin-bottom: .7rem;
}

.colony-feeding-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .65rem;
  margin: .8rem 0;
}

.colony-feeding-grid .feeding-kpi-card {
  min-height: 0;
  display: grid;
  gap: .2rem;
  align-content: center;
  padding: .7rem;
  border: 1px solid #b8d9d2;
  border-radius: 14px;
  background: #fff;
}

.colony-feeding-grid strong {
  color: var(--brand-primary);
  font-size: 1.2rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.colony-feeding-grid span {
  color: #64748b;
  font-size: .78rem;
  font-weight: 850;
  line-height: 1.1;
}

.colony-ops-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  align-items: stretch;
}

.colony-census-card .grid.four {
  gap: .6rem;
}

.colony-census-card .grid.four > div {
  padding: .7rem;
  border: 1px solid #e1ebe8;
  border-radius: 14px;
  background: #f8fcfa;
}

.request-lower-grid {
  grid-template-columns: minmax(0, .95fr) minmax(340px, 1fr) minmax(320px, .9fr);
}

.request-module-grid {
  align-items: start;
}

.request-public-shell {
  max-width: 1180px;
  margin-inline: auto;
}

.public-request-form {
  max-width: 980px;
}

.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.toggle-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .75rem;
  align-items: start;
  padding: .85rem;
  border: 1px solid #dce9e5;
  border-radius: 16px;
  background: #f7fcfa;
}

.toggle-field input {
  width: 22px;
  height: 22px;
  margin-top: .15rem;
  accent-color: var(--brand-primary);
}

.toggle-field strong,
.toggle-field small {
  display: block;
}

.toggle-field strong {
  color: var(--brand-dark);
}

.toggle-field small {
  margin-top: .2rem;
  color: #64748b;
  font-weight: 700;
  line-height: 1.3;
}

.report-photo-preview {
  width: fit-content;
  display: inline-flex;
  gap: .55rem;
  align-items: center;
  margin-top: .65rem;
  padding: .35rem .7rem .35rem .35rem;
  border: 1px solid #b8d9d2;
  border-radius: 999px;
  background: #f7fcfa;
  color: var(--brand-primary);
  font-weight: 850;
  text-decoration: none;
}

.report-photo-preview img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 999px;
  object-fit: cover;
}

.reports-pro-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, auto);
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #dce9e5;
  border-radius: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fcfa 100%);
  box-shadow: 0 18px 44px rgba(15, 36, 55, .06);
}

.reports-pro-title {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: .85rem;
  align-items: center;
}

.reports-pro-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid #b8d9d2;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.reports-pro-icon svg {
  background: transparent;
}

.reports-pro-title .eyebrow {
  color: #64748b;
  font-weight: 900;
}

.reports-pro-title h1 {
  margin: .1rem 0 .2rem;
  color: var(--brand-dark);
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  line-height: 1.02;
}

.reports-pro-title p {
  max-width: 760px;
  margin: 0;
  color: #475569;
  font-weight: 650;
  line-height: 1.35;
}

.reports-pro-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: flex-end;
  align-items: end;
}

.reports-pro-controls label {
  min-width: 170px;
  display: grid;
  gap: .25rem;
  color: #64748b;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.reports-pro-controls select {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid #b8d9d2;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 850;
}

.reports-pro-controls .reports-export-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  white-space: nowrap;
}

.reports-pro-controls .reports-export-btn .app-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 1.05rem;
  display: block;
}

.reports-pro-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
  margin-bottom: 1rem;
}

.reports-pro-kpi {
  min-width: 0;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: .85rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid #dce9e5;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 36, 55, .055);
}

.reports-pro-kpi > span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #ecfdf5;
  color: var(--brand-primary);
}

.reports-pro-kpi--amber > span {
  background: #fff7ed;
  color: #d97706;
}

.reports-pro-kpi--green > span {
  background: #ecfdf5;
  color: #15803d;
}

.reports-pro-kpi--blue > span {
  background: #eff6ff;
  color: #2563eb;
}

.reports-pro-kpi small,
.reports-pro-kpi strong,
.reports-pro-kpi em {
  display: block;
  min-width: 0;
}

.reports-pro-kpi small {
  color: #475569;
  font-weight: 850;
  line-height: 1.15;
}

.reports-pro-kpi strong {
  margin-top: .18rem;
  color: var(--brand-dark);
  font-size: 1.55rem;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.reports-pro-kpi em {
  margin-top: .25rem;
  color: var(--brand-primary);
  font-style: normal;
  font-size: .86rem;
  font-weight: 850;
  line-height: 1.15;
}

.reports-shortcuts {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #dce9e5;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 36, 55, .045);
}

.reports-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.reports-shortcut-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: .7rem;
  align-items: center;
  padding: .85rem;
  border: 1px solid #dce9e5;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfa 100%);
  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.reports-shortcut-card:hover,
.reports-shortcut-card:focus-visible {
  border-color: #9bcac0;
  box-shadow: 0 16px 30px rgba(15, 36, 55, .08);
  transform: translateY(-1px);
}

.reports-shortcut-card > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.reports-shortcut-card small,
.reports-shortcut-card strong,
.reports-shortcut-card em {
  display: block;
  min-width: 0;
}

.reports-shortcut-card small {
  color: var(--brand-primary);
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.reports-shortcut-card strong {
  margin-top: .08rem;
  color: var(--brand-dark);
  font-weight: 900;
  line-height: 1.12;
}

.reports-shortcut-card em {
  margin-top: .16rem;
  color: #64748b;
  font-style: normal;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.2;
}

.reports-shortcut-card--vet {
  grid-template-columns: 46px minmax(0, 1fr);
  grid-template-rows: auto auto;
  cursor: default;
}

.reports-shortcut-card--vet:hover {
  transform: none;
  box-shadow: none;
  border-color: #dce9e5;
}

.reports-vet-year-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-top: .6rem;
  border-top: 1px solid #e8f0ed;
  margin-top: .25rem;
}

.reports-vet-year-row select {
  flex: 1;
  min-width: 0;
  font-size: .82rem;
  padding: .3rem .5rem;
  border: 1px solid #dce9e5;
  border-radius: 8px;
  background: #fff;
  color: var(--brand-dark);
}

.reports-vet-year-row .btn-sm {
  font-size: .78rem;
  padding: .3rem .65rem;
  border-radius: 8px;
  white-space: nowrap;
}

.reports-dashboard-grid {
  margin-top: 1rem;
}

.reports-dashboard-grid .report-widget {
  border-color: #dce9e5;
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(15, 36, 55, .045);
}

.reports-dashboard-grid .dashboard-widget-titlebar {
  align-items: flex-start;
  padding-bottom: .65rem;
  border-bottom: 1px solid #edf3f1;
}

.reports-dashboard-grid .dashboard-widget-heading h2 {
  color: var(--brand-dark);
  font-size: 1.15rem;
}

.reports-dashboard-grid .dashboard-widget-heading p {
  color: #64748b;
  font-size: .86rem;
}

.reports-dashboard-grid .table-wrap {
  border-radius: 14px;
}

.reports-dashboard-grid--executive {
  gap: 1rem;
  align-items: stretch;
}

.reports-dashboard-grid--executive .report-widget {
  padding: 1rem;
  background: #fff;
}

.reports-dashboard-grid--executive .reports-chart-card {
  min-height: 328px;
}

.reports-dashboard-grid--executive .reports-chart-card .report-chart {
  width: 100%;
  min-height: 244px;
  height: 244px;
}

.reports-dashboard-grid--executive .chart-legend {
  margin-top: .4rem;
}

.report-chart-summary {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  margin: .15rem 0 .55rem;
  color: #667085;
  font-size: .78rem;
  font-weight: 650;
}

.report-chart-summary span {
  padding: .28rem .55rem;
  border: 1px solid #dbe7e4;
  border-radius: 999px;
  background: #f8fbfa;
}

.report-chart-summary strong {
  color: #0f2437;
}

.reports-table-card {
  min-width: 0;
  overflow: hidden;
}

.reports-executive-table {
  min-width: 780px;
}

.reports-executive-table th {
  color: #475569;
  font-size: .78rem;
  font-weight: 900;
  text-transform: none;
  white-space: normal;
}

.reports-executive-table td {
  vertical-align: middle;
  color: var(--brand-dark);
  font-weight: 800;
}

.reports-executive-table td:first-child {
  min-width: 190px;
}

.reports-executive-table a {
  color: var(--brand-dark);
  font-weight: 900;
  text-decoration: none;
}

.reports-executive-table a:hover,
.reports-executive-table a:focus-visible {
  color: var(--brand-primary);
  text-decoration: underline;
}

.reports-metric-with-bar {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  white-space: nowrap;
}

.reports-metric-with-bar strong {
  color: var(--brand-dark);
  font-weight: 900;
}

.reports-progress {
  width: min(96px, 42vw);
  height: 8px;
  display: inline-flex;
  border-radius: 999px;
  background: #e8f1ef;
  overflow: hidden;
  vertical-align: middle;
}

.reports-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-primary);
}

.reports-insights-card {
  min-height: 100%;
}

.reports-insight-list {
  display: grid;
  gap: .9rem;
}

.reports-insight-list article {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: .75rem;
  align-items: start;
}

.reports-insight-list span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.reports-insight-list p {
  margin: 0;
  color: #475569;
  font-weight: 750;
  line-height: 1.35;
}

.reports-census-card {
  display: grid;
  align-content: start;
  gap: .95rem;
}

.reports-census-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.reports-census-kpi {
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: .65rem;
  align-items: center;
  padding: .85rem;
  border: 1px solid #dce9e5;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfa 100%);
}

.reports-census-kpi > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
}

.reports-census-kpi--female > span {
  background: #fff1f7;
  color: #db2777;
}

.reports-census-kpi--male > span {
  background: #eff6ff;
  color: #2563eb;
}

.reports-census-kpi--unknown > span {
  background: #f1f5f9;
  color: #64748b;
}

.reports-census-kpi--health > span {
  background: #ecfdf5;
  color: #15803d;
}

.reports-census-kpi strong,
.reports-census-kpi small {
  display: block;
  min-width: 0;
}

.reports-census-kpi strong {
  color: var(--brand-dark);
  font-size: 1.45rem;
  font-weight: 950;
  line-height: 1;
}

.reports-census-kpi small {
  margin-top: .15rem;
  color: #64748b;
  font-weight: 850;
  line-height: 1.15;
}

.reports-census-note {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: .75rem;
  align-items: start;
  padding: .85rem;
  border: 1px solid #dce9e5;
  border-radius: 16px;
  background: #f8fcfa;
}

.reports-census-note span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #fff;
  color: var(--brand-primary);
}

.reports-census-note p {
  margin: 0;
  color: var(--brand-dark);
  font-weight: 750;
  line-height: 1.35;
}

.reports-generated {
  margin-top: 1rem;
}

.reports-generated .reports-shortcut-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .reports-pro-hero {
    grid-template-columns: 1fr;
  }

  .reports-pro-controls {
    justify-content: flex-start;
  }

  .reports-pro-kpis,
  .reports-shortcut-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reports-generated .reports-shortcut-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .incident-detail-head,
  .incident-detail-grid,
  .incident-lower-grid,
  .request-lower-grid {
    grid-template-columns: 1fr;
  }

  .incident-summary-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .reports-pro-hero,
  .reports-shortcuts {
    padding: .8rem;
    border-radius: 18px;
  }

  .reports-pro-title {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: .65rem;
  }

  .reports-pro-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .reports-pro-title h1 {
    font-size: 1.55rem;
  }

  .reports-pro-controls,
  .reports-pro-controls label,
  .reports-pro-controls .btn {
    width: 100%;
  }

  .reports-pro-kpis,
  .reports-shortcut-grid {
    grid-template-columns: 1fr;
    gap: .6rem;
  }

  .reports-dashboard-grid--executive .reports-chart-card {
    min-height: 286px;
  }

  .reports-dashboard-grid--executive .reports-chart-card .report-chart {
    min-height: 210px;
    height: 210px;
  }

  .reports-generated .reports-shortcut-grid {
    grid-template-columns: 1fr;
  }

  .reports-census-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
  }

  .reports-census-kpi {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: .45rem;
    padding: .65rem;
  }

  .reports-census-kpi > span {
    width: 32px;
    height: 32px;
    border-radius: 12px;
  }

  .reports-census-kpi strong {
    font-size: 1.18rem;
  }

  .reports-census-kpi small {
    font-size: .78rem;
  }

  .reports-census-note {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: .7rem;
  }

  .reports-census-note span {
    width: 32px;
    height: 32px;
    border-radius: 12px;
  }

  .reports-pro-kpi {
    grid-template-columns: 46px minmax(0, 1fr);
    padding: .78rem;
  }

  .reports-pro-kpi > span {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .reports-pro-kpi strong {
    font-size: 1.28rem;
  }

  .incident-detail-shell {
    gap: .8rem;
    padding: .75rem;
    border-radius: 20px;
  }

  .incident-title-block {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: .7rem;
  }

  .incident-detail-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .incident-detail-icon svg {
    width: 24px;
    height: 24px;
  }

  .incident-title-block h2 {
    font-size: 1.45rem;
  }

  .incident-title-block p:last-child {
    font-size: .92rem;
  }

  .incident-status-card,
  .incident-facts-card,
  .incident-summary-card,
  .incident-history-card,
  .incident-manage-card {
    padding: .85rem;
    border-radius: 16px;
  }

  .incident-media-card,
  .incident-media-card img,
  .incident-media-fallback {
    min-height: 190px;
  }

  .incident-facts-card dl > div {
    min-width: 0;
    grid-template-columns: 1fr;
    gap: .2rem;
    padding: .65rem;
    border: 1px solid #e1ebe8;
    border-radius: 14px;
    background: #f8fcfa;
  }

  .incident-facts-card h3 {
    margin-bottom: .7rem;
    font-size: 1.35rem;
  }

  .incident-facts-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
  }

  .incident-facts-card dt {
    gap: .35rem;
    font-size: .82rem;
    line-height: 1.15;
  }

  .incident-facts-card dt svg {
    width: 17px;
    height: 17px;
  }

  .incident-facts-card dd {
    font-size: 1rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .incident-facts-card dl > div:nth-child(2),
  .incident-facts-card dl > div:nth-child(3) {
    grid-column: span 2;
  }

  .request-detail-shell .incident-facts-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .request-detail-shell .incident-facts-card dl > div:nth-child(2),
  .request-detail-shell .incident-facts-card dl > div:nth-child(3) {
    grid-column: auto;
  }

  .status-report-detail-shell .incident-facts-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-report-detail-shell .incident-facts-card dl > div:nth-child(3),
  .status-report-detail-shell .incident-facts-card dl > div:nth-child(4) {
    grid-column: span 2;
  }

  .colony-detail-hero,
  .colony-detail-overview {
    grid-template-columns: 1fr;
  }

  .colony-detail-actions {
    min-width: 0;
    justify-content: stretch;
  }

  .colony-detail-actions .btn,
  .colony-detail-actions .button {
    width: 100%;
  }

  .colony-detail-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
  }

  .colony-detail-kpi {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: .6rem;
  }

  .colony-detail-kpi > span {
    width: 32px;
    height: 32px;
    border-radius: 12px;
  }

  .colony-detail-kpi strong {
    font-size: 1.08rem;
  }

  .colony-photo-strip-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 82%);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .colony-photo-chip {
    grid-template-columns: 64px minmax(0, 1fr);
    padding-right: 2.25rem;
  }

  .colony-photo-chip img {
    width: 64px;
    height: 54px;
  }

  .colony-photo-chip .photo-card-delete {
    position: absolute;
    top: .4rem;
    right: .4rem;
  }

  .colony-ops-grid {
    grid-template-columns: 1fr;
  }

  .colony-feeding-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .incident-workflow-help {
    padding: .7rem;
  }

  .incident-workflow-help li {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .incident-workflow-help small {
    grid-column: 2;
  }

  .incident-summary-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
  }

  .incident-summary-kpis article {
    min-height: 0;
    padding: .65rem;
    gap: .3rem;
    align-content: center;
    text-align: center;
  }

  .incident-summary-kpis span {
    width: 40px;
    height: 40px;
    margin-inline: auto;
    border-radius: 14px;
  }

  .incident-summary-kpis strong {
    font-size: 1rem;
    overflow-wrap: anywhere;
  }

  .incident-summary-kpis small {
    font-size: .78rem;
    line-height: 1.1;
  }
}

.clinical-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: .4rem;
  padding: .28rem .6rem;
  border-radius: 999px;
  font-weight: 850;
  font-size: .78rem;
}

.clinical-status::before {
  content: "";
  width: .48rem;
  height: .48rem;
  border-radius: 999px;
  background: currentColor;
}

.clinical-status--ok { background: #ecfdf5; color: #15803d; }
.clinical-status--active { background: #ecfdf5; color: var(--brand-primary); }
.clinical-status--notice { background: #eff6ff; color: #2563eb; }
.clinical-status--warning { background: #fffbeb; color: #d97706; }
.clinical-status--muted { background: #f1f5f9; color: #64748b; }

.clinical-see-all {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  width: fit-content;
  color: var(--brand-primary);
  font-weight: 850;
  text-decoration: none;
}

.clinical-detail {
  display: grid;
  gap: .9rem;
  padding: 1rem;
}

.clinical-hero {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-primary-pale), #fff);
}

.clinical-hero img,
.clinical-hero-fallback {
  width: 100%;
  height: 100%;
  min-height: 250px;
  object-fit: cover;
  display: grid;
  place-items: center;
}

.clinical-hero .clinical-status {
  position: absolute;
  top: .75rem;
  right: .75rem;
}

.clinical-profile h2 {
  margin: 0;
  color: var(--brand-dark);
}

.clinical-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem 1rem;
  margin-top: .55rem;
  color: #64748b;
  font-weight: 750;
}

.clinical-meta span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.clinical-timeline {
  display: grid;
  gap: .8rem;
}

.clinical-timeline h3,
.clinical-docs h3,
.cat-clinical-aside h3 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 1.18rem;
  font-weight: 900;
}

.clinical-timeline-list {
  position: relative;
  display: grid;
  gap: .72rem;
  padding-left: .2rem;
}

.clinical-timeline-list::before {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 25px;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-primary) 48%, #dbe7e3), #dbe7e3);
  box-shadow: 0 0 0 4px rgba(11,125,109,.07);
}

.clinical-timeline-item {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 52px 118px minmax(0, 1fr) minmax(150px, .32fr);
  gap: .72rem;
  align-items: start;
  padding: .82rem .9rem;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 22%, #dbe7e3);
  border-left-width: 4px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff 0%, #fbfefd 100%);
  box-shadow: 0 12px 26px rgba(15,36,55,.055);
}

.clinical-timeline-item.is-active {
  border-color: var(--brand-primary);
  border-left-width: 6px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 20%, transparent), 0 12px 26px rgba(15,36,55,.08);
}

.clinical-timeline-item > span:first-child {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 5px #fff, 0 0 0 9px color-mix(in srgb, var(--brand-primary) 18%, transparent);
}

.clinical-timeline-item.is-done > span:first-child {
  background: #fff;
}

.clinical-timeline-item.is-done > span:first-child::before {
  content: none;
}

.clinical-timeline-item time {
  color: #64748b;
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.12;
}

.clinical-timeline-item strong {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .42rem;
  color: var(--brand-dark);
  font-size: 1.05rem;
  line-height: 1.15;
}

.clinical-timeline-item p,
.clinical-timeline-item small {
  margin: .14rem 0 0;
  color: #64748b;
  font-size: .92rem;
  font-weight: 750;
  line-height: 1.28;
}

.clinical-timeline-item div,
.clinical-timeline-item small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.clinical-timeline-edit {
  grid-column: 3 / -1;
  width: fit-content;
  color: var(--brand-primary);
  font-weight: 850;
  text-decoration: none;
}

.clinical-docs {
  display: grid;
  gap: .65rem;
}

.clinical-docs-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: .6rem;
}

.clinical-doc-thumb {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .32rem;
  padding: .58rem;
  overflow: hidden;
  border: 1px solid #e5ece9;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 800;
  text-align: center;
}

.clinical-doc-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  overflow: hidden;
  border-radius: 10px;
}

.clinical-doc-thumb--image .clinical-doc-preview {
  width: 100%;
  height: 58px;
}

.clinical-doc-preview img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
}

.clinical-doc-thumb--file,
.clinical-doc-thumb--empty {
  padding: .55rem;
  text-align: center;
}

.clinical-doc-label,
.clinical-doc-event {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
}

.clinical-doc-label {
  -webkit-line-clamp: 2;
  line-height: 1.12;
}

.clinical-doc-event {
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
  line-height: 1.12;
}

.clinical-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.clinical-costs {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem;
}

.clinical-costs strong {
  color: var(--brand-primary);
  font-size: 1.4rem;
}

/* Ficha de gato · resumen compacto */
.cat-profile-card {
  overflow: hidden;
}

.grid.two.cat-profile-grid {
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  align-items: start;
  gap: 1rem 1.15rem;
}

.cat-profile-media {
  display: contents;
}

.cat-profile-media > .photo-modal-trigger {
  display: block;
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  width: min(100%, 280px);
  height: 280px;
  max-width: 100%;
  max-height: 280px;
  aspect-ratio: 1 / 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.cat-profile-media > .photo-modal-trigger > .cat-photo {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  border-radius: 18px;
}

.cat-profile-media .actions {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  margin-top: .1rem;
  padding-top: .75rem;
  border-top: 1px solid #e5ece9;
}

.cat-profile-media .actions .btn,
.cat-profile-media .actions .button,
.cat-profile-media .actions button {
  min-height: 42px;
}

.cat-profile-info {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.cat-profile-info h2 {
  margin: 0 0 .35rem;
  color: var(--brand-dark);
  line-height: 1.05;
}

.cat-profile-info h2 small {
  color: inherit;
  font-size: .78em;
}

.cat-profile-location {
  margin: 0 0 .65rem;
  color: #64748b;
  font-weight: 750;
  line-height: 1.25;
}

.cat-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0 0 .8rem;
}

.grid.two.cat-profile-facts {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .62rem;
}

.cat-profile-facts p {
  min-width: 0;
  margin: 0;
  padding: .68rem .75rem;
  border: 1px solid #e5ece9;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff 0%, #f8fdfb 100%);
  color: var(--brand-dark);
  line-height: 1.18;
}

.cat-profile-facts strong {
  display: block;
  margin-bottom: .18rem;
  color: #64748b;
  font-size: .78rem;
  font-weight: 850;
  line-height: 1.05;
}

/* Ficha de gato · sección clínica compacta */
.cat-clinical-section {
  margin-top: 1rem;
}

.cat-clinical-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.cat-clinical-head h2,
.cat-clinical-head p {
  margin: .15rem 0 0;
}

.cat-clinical-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 1rem;
  align-items: start;
}

.cat-clinical-main,
.cat-clinical-aside {
  display: grid;
  gap: .85rem;
  min-width: 0;
}

.cat-clinical-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
}

.clinical-summary-kpi {
  min-height: 78px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-items: center;
  gap: .2rem .55rem;
  overflow: hidden;
  padding: .62rem .7rem;
  border: 1px solid #dfe9e5;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff 0%, #f8fdfb 100%);
  box-shadow: 0 8px 20px rgba(15,36,55,.04);
  color: #64748b;
}

.clinical-summary-kpi > .app-icon,
.clinical-summary-kpi > svg,
.clinical-summary-euro,
.clinical-summary-kpi--status > i {
  grid-row: 1 / span 2;
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--brand-primary-pale);
  color: var(--brand-primary);
  font-size: 1.25rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.clinical-summary-kpi--status > i::before {
  content: "";
  width: .58rem;
  height: .58rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand-primary) 14%, transparent);
}

.clinical-summary-kpi > small {
  grid-column: 2;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #64748b;
  font-size: .78rem;
  font-weight: 850;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clinical-summary-kpi > strong {
  grid-column: 2;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--brand-dark);
  font-size: clamp(1rem, 1.7vw, 1.24rem);
  font-weight: 900;
  line-height: 1.05;
}

.clinical-summary-kpi > .clinical-summary-date {
  max-width: 100%;
  overflow: hidden;
  color: var(--brand-dark);
  font-family: inherit;
  font-size: clamp(.92rem, 2.8vw, 1.08rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.025em;
  line-height: 1;
  text-overflow: clip;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.clinical-summary-kpi > .clinical-status {
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  padding: .26rem .5rem;
  overflow: hidden;
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-clinical-aside > section {
  display: grid;
  gap: .5rem;
  padding: .8rem;
  border: 1px solid #e5ece9;
  border-radius: 16px;
  background: #fff;
}

.cat-clinical-notes p {
  margin: .15rem 0;
  color: #64748b;
}

.compact-note-form {
  gap: .45rem;
}

.compact-note-form textarea {
  min-height: 74px;
}

@media (max-width: 1180px) {
  .clinical-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cat-clinical-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clinical-board,
  .cat-clinical-grid {
    grid-template-columns: 1fr;
  }

  .clinical-table-wrap {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .cat-profile-card {
    padding: .85rem;
    border-radius: 20px;
  }

  .grid.two.cat-profile-grid {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: .75rem;
    align-items: start;
  }

  .cat-profile-media {
    display: contents;
    min-width: 0;
  }

  .cat-profile-media > .photo-modal-trigger {
    grid-column: 1;
    order: 1;
    width: 104px;
    height: 104px;
  }

  .cat-profile-media .cat-photo {
    width: 104px;
    height: 104px;
    object-fit: cover;
    border-radius: 18px;
  }

  .cat-profile-media .actions {
    grid-column: 1 / -1;
    grid-row: auto;
    order: 3;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: .38rem;
    margin-top: 0;
  }

  .cat-profile-media .actions .btn,
  .cat-profile-media .actions .button,
  .cat-profile-media .actions button {
    width: 100%;
    min-height: 32px;
    padding: .42rem .5rem;
    font-size: .72rem;
    line-height: 1.05;
  }

  .cat-profile-info {
    display: contents;
    min-width: 0;
  }

  .cat-profile-info h2,
  .cat-profile-location,
  .cat-profile-badges {
    grid-column: 2;
    min-width: 0;
    order: 1;
  }

  .cat-profile-info h2 {
    margin-bottom: .28rem;
    font-size: clamp(1.45rem, 8vw, 2rem);
    overflow-wrap: anywhere;
  }

  .cat-profile-location {
    margin-bottom: .48rem;
    font-size: .95rem;
    line-height: 1.18;
  }

  .cat-profile-badges {
    gap: .32rem;
    margin-bottom: .62rem;
  }

  .cat-profile-badges .badge {
    padding: .26rem .48rem;
    font-size: .72rem;
    line-height: 1.05;
    white-space: normal;
  }

  .cat-profile-facts {
    grid-column: 1 / -1;
    order: 2;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: .45rem;
  }

  .cat-profile-facts p {
    padding: .46rem .52rem;
    border-radius: 13px;
    font-size: .86rem;
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .cat-profile-facts strong {
    margin-bottom: .14rem;
    font-size: .68rem;
  }

  .cat-clinical-summary {
    gap: .5rem;
  }

  .clinical-summary-kpi {
    min-height: 72px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: .18rem .45rem;
    padding: .55rem .58rem;
  }

  .clinical-summary-kpi > .app-icon,
  .clinical-summary-kpi > svg,
  .clinical-summary-euro,
  .clinical-summary-kpi--status > i {
    width: 30px;
    height: 30px;
    min-width: 30px;
    font-size: 1.05rem;
  }

  .clinical-summary-kpi > small {
    font-size: .68rem;
  }

  .clinical-summary-kpi > strong {
    font-size: .95rem;
  }

  .clinical-summary-kpi > .clinical-status {
    padding: .22rem .42rem;
    font-size: .66rem;
  }

  .clinical-timeline-item {
    grid-template-columns: 52px auto minmax(0, 1fr);
    grid-template-rows: auto auto auto ;
    padding: .74rem .72rem;
    gap: .3rem .6rem;
  }

  .clinical-timeline-item > .clinical-event-icon {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: start;
  }

  .clinical-timeline-item time {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    white-space: nowrap;
  }

  .clinical-timeline-item div {
    grid-column: 3;
    grid-row: 1;
  }

  .clinical-timeline-item small,
  .clinical-timeline-edit {
    grid-column: 2 / -1;
    grid-row: auto;
  }

  .clinical-docs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .grid.two.cat-profile-grid {
    grid-template-columns: 1fr;
  }

  .cat-profile-media {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: .6rem;
    align-items: start;
  }

  .cat-profile-media > .photo-modal-trigger {
    width: 88px;
    height: 88px;
  }

  .cat-profile-media .cat-photo {
    width: 88px;
    height: 88px;
  }

  .cat-profile-media .actions {
    margin-top: 0;
  }

  .cat-clinical-summary {
    grid-template-columns: 1fr;
  }

}

/* Iconos en metadatos y adjuntos clínicos */
.clinical-meta .app-icon,
.clinical-meta img,
.clinical-meta svg,
.clinical-date .app-icon,
.clinical-date img,
.clinical-date svg {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex: 0 0 18px;
  padding: 0;
  border-radius: 5px;
  clip-path: inset(0 round 5px);
  object-fit: contain;
  background: transparent;
}

.cat-clinical-section .clinical-timeline-list {
  max-height: none;
}

.clinical-timeline-item .badge,
.clinical-timeline-item [class*="badge-"] {
  width: fit-content;
}

.clinical-hero-fallback .app-icon,
.clinical-hero-fallback img,
.clinical-hero-fallback svg,
.clinical-doc-thumb .app-icon,
.clinical-doc-thumb svg {
  width: 34px;
  height: 34px;
  max-width: 34px;
  max-height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border-radius: 9px;
  clip-path: inset(0 round 9px);
  object-fit: contain;
  background: transparent;
}

.vet-attachment-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .8rem;
  margin-top: .75rem;
}

.vet-attachment-item {
  display: grid;
  gap: .55rem;
}

.vet-attachment-item .clinical-doc-thumb {
  width: 100%;
}

.vet-attachment-delete {
  display: inline-flex;
  gap: .45rem;
  align-items: center;
  min-height: 42px;
  padding: .45rem .6rem;
  border: 1px solid #f4c7d2;
  border-radius: 12px;
  background: #fff7f8;
  color: #a21d3c;
  font-size: .86rem;
  font-weight: 800;
}

.vet-attachment-delete input {
  width: 18px;
  height: 18px;
  accent-color: #a21d3c;
}

/* Iconos clínicos: tamaño consistente */
.clinical-kpi .app-icon,
.clinical-kpi svg,
.module-pro-icon .app-icon,
.module-pro-icon svg,
.clinical-head .app-icon,
.clinical-head svg {
  max-width: 32px;
  max-height: 32px;
}

.clinical-kpi > span .app-icon,
.clinical-kpi > span svg {
  width: 28px;
  height: 28px;
}

.clinical-kpi > span .app-illustrated-icon,
.clinical-kpi > span svg.app-illustrated-icon,
.clinical-kpi > span .health-set-a-icon.app-illustrated-icon,
.clinical-kpi > span .app-generated-icon,
.clinical-kpi > span .health-set-a-icon.app-generated-icon {
  width: 58px;
  height: 58px;
  max-width: 58px;
  max-height: 58px;
}

.clinical-kpi > span:has(.app-generated-icon) {
  width: 64px;
  height: 64px;
}

.clinical-table td,
.clinical-table th {
  white-space: normal;
}

.clinical-table td:nth-child(3),
.clinical-table td:nth-child(4) {
  max-width: 220px;
}

.clinical-table td:nth-child(3),
.clinical-table td:nth-child(4),
.clinical-table td:nth-child(5) {
  overflow-wrap: anywhere;
}

/* SVG sanitarios: posicionamiento base e iconos por tipo */
.health-set-a-icon,
.clinical-event-icon .health-set-a-icon,
.clinical-kpi .health-set-a-icon {
  display: block;
  object-fit: contain;
  object-position: center;
  transform: none;
  border-radius: 0;
}

.clinical-kpi > span {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center ;
}

.clinical-kpi > span .health-set-a-icon,
.clinical-kpi img[src$=".svg"] {
  width: 56px;
  height: 56px;
  max-width: 56px;
  max-height: 56px;
}

.clinical-kpi > span .app-icon,
.clinical-kpi > span svg,
.clinical-kpi > span .app-generated-icon {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.clinical-event-icon .health-set-a-icon--pill,
.clinical-event-icon img[src$="/pill.svg"] {
  width: 34px;
  height: 34px;
  max-width: 34px;
  max-height: 34px;
}

.clinical-event-icon .health-set-a-icon--syringe,
.clinical-event-icon img[src$="/syringe.svg"] {
  width: 42px;
  height: 42px;
  max-width: 42px;
  max-height: 42px;
}

.clinical-event-icon .health-set-a-icon--scalpel,
.clinical-event-icon img[src$="/scalpel.svg"] {
  width: 39px;
  height: 39px;
  max-width: 39px;
  max-height: 39px;
}

.clinical-event-icon .health-set-a-icon--bug,
.clinical-event-icon img[src$="/bug.svg"] {
  width: 38px;
  height: 38px;
  max-width: 38px;
  max-height: 38px;
}

.clinical-event-icon .health-set-a-icon--scissors,
.clinical-event-icon img[src$="/scissors.svg"] {
  width: 38px;
  height: 38px;
  max-width: 38px;
  max-height: 38px;
}

.clinical-kpi .health-set-a-icon--pill,
.clinical-kpi img[src$="/pill.svg"] {
  width: 40px;
  height: 40px;
}

.clinical-kpi .health-set-a-icon--syringe,
.clinical-kpi img[src$="/syringe.svg"] {
  width: 48px;
  height: 48px;
}

/* SVG sanitarios: ajustes de tamaño para stethoscope y cat-treatment */
.clinical-kpi .health-set-a-icon--bandage,
.clinical-kpi img[src$="/bandage.svg"] {
  width: 50px;
  height: 50px;
  max-width: 50px;
  max-height: 50px;
}

.clinical-event-icon .health-set-a-icon--stethoscope,
.clinical-event-icon img[src$="/stethoscope.svg"] {
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
}

.clinical-kpi .health-set-a-icon--cat-treatment,
.clinical-kpi img[src$="/cat-treatment.svg"] {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
}

.nav-item .app-icon-type-cat,
.module-card .app-icon-type-cat,
.stat-card .app-icon-type-cat {
  stroke-width: 1.9;
}

/* Veterinaria: tamaños de foto/iconos */
.clinical-hero,
.clinical-hero img,
.clinical-hero-fallback {
  min-height: 170px;
  max-height: 235px;
  object-fit: cover;
}

.clinical-event-icon .health-set-a-icon,
.clinical-event-icon img[src$=".svg"] {
  width: 42px;
  height: 42px;
  max-width: 42px;
  max-height: 42px;
  object-fit: contain;
  object-position: center;
}

.clinical-event-icon .health-set-a-icon--bandage,
.clinical-event-icon img[src$="/bandage.svg"] {
  width: 46px;
  height: 46px;
  max-width: 46px;
  max-height: 46px;
}

@media (max-width: 1180px) {
  .clinical-board {
    grid-template-columns: 1fr;
  }
}

/* Veterinaria escritorio: tabla de pacientes y foto de detalle */

@media (min-width: 1024px) {
  .clinical-board {
    grid-template-columns: minmax(630px, 1.04fr) minmax(600px, .96fr);
    gap: 1rem;
    align-items: start;
  }

  .clinical-patients {
    padding: 1rem;
  }

  .clinical-patients h2 {
    font-size: 1.35rem;
    line-height: 1.12;
    margin-bottom: .15rem;
  }

  .clinical-patients > p {
    font-size: .92rem;
    line-height: 1.25;
    margin-bottom: .8rem;
  }

  .clinical-filters {
    display: grid;
    grid-template-columns: minmax(230px, 1fr) minmax(150px, .52fr) minmax(150px, .52fr);
    gap: .55rem;
    margin-bottom: .75rem;
  }

  .clinical-filters input,
  .clinical-filters select {
    min-height: 42px;
    padding: .55rem .7rem;
    font-size: .88rem;
    min-width: 0;
  }

  .clinical-patients table {
    table-layout: fixed;
    width: 100%;
  }

  .clinical-patients th,
  .clinical-patients td {
    padding: .56rem .55rem;
    vertical-align: middle;
  }

  .clinical-patients th:nth-child(1),
  .clinical-patients td:nth-child(1) {
    width: 25%;
  }

  .clinical-patients th:nth-child(2),
  .clinical-patients td:nth-child(2) {
    width: 43%;
  }

  .clinical-patients th:nth-child(3),
  .clinical-patients td:nth-child(3) {
    width: 17%;
    white-space: nowrap;
  }

  .clinical-patients th:nth-child(4),
  .clinical-patients td:nth-child(4) {
    width: 15%;
    white-space: nowrap;
  }

  .clinical-patients td:nth-child(3) {
    font-size: .92rem;
    line-height: 1.1;
    letter-spacing: -.01em;
  }

  .clinical-patient {
    gap: .55rem;
    min-width: 0;
  }

  .clinical-patient-photo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 11px;
  }

  .clinical-patient span:last-child,
  .clinical-case {
    min-width: 0;
  }

  .clinical-patient strong,
  .clinical-case strong {
    font-size: .94rem;
    line-height: 1.12;
  }

  .clinical-patient small,
  .clinical-case small,
  .clinical-case em {
    display: block;
    font-size: .79rem;
    line-height: 1.18;
    color: var(--muted, #697386);
    font-style: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  .clinical-case {
    display: grid;
    gap: .12rem;
  }

  .clinical-case em {
    opacity: .95;
  }

  .clinical-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-align: center;
    line-height: 1;
    padding: .34rem .55rem;
    font-size: .72rem;
    letter-spacing: -.01em;
    min-width: 94px;
    max-width: 100%;
  }

  .clinical-see-all {
    margin-top: .75rem;
  }

  .clinical-detail {
    padding: 1rem;
    gap: .75rem;
  }

  .clinical-hero {
    border-radius: 18px;
    overflow: hidden;
  }

  .clinical-hero,
  .clinical-hero img,
  .clinical-hero-fallback {
    width: 100%;
    min-height: 190px;
    max-height: 235px;
    object-fit: cover;
  }

  .clinical-detail h2 {
    font-size: clamp(1.5rem, 1.85vw, 1.9rem);
    line-height: 1.05;
    margin-bottom: .15rem;
  }

  .clinical-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    font-size: .9rem;
    line-height: 1.18;
  }

  .clinical-detail h3 {
    margin-top: .2rem;
    margin-bottom: .45rem;
    font-size: 1rem;
  }

}

/* Escritorios medianos: mantiene dos columnas y evita fecha/estado partidos. */
@media (min-width: 1024px) and (max-width: 1320px) {
  .clinical-board {
    grid-template-columns: minmax(580px, 1.08fr) minmax(500px, .92fr);
  }

  .clinical-filters {
    grid-template-columns: 1fr;
  }

  .clinical-patients th:nth-child(1),
  .clinical-patients td:nth-child(1) {
    width: 24%;
  }

  .clinical-patients th:nth-child(2),
  .clinical-patients td:nth-child(2) {
    width: 40%;
  }

  .clinical-patients th:nth-child(3),
  .clinical-patients td:nth-child(3) {
    width: 18%;
  }

  .clinical-patients th:nth-child(4),
  .clinical-patients td:nth-child(4) {
    width: 18%;
  }

  .clinical-status {
    min-width: 88px;
    font-size: .69rem;
    padding-inline: .45rem ;
  }

  .clinical-hero,
  .clinical-hero img,
  .clinical-hero-fallback {
    min-height: 175px;
    max-height: 220px;
  }
}

/* Veterinaria escritorio: espaciado, iconos de metadatos y altura de foto */

@media (min-width: 1024px) {
  .clinical-patients {
    padding-right: 1.25rem ;
    overflow: visible;
  }

  .clinical-patients table {
    width: calc(100% - .45rem);
    margin-right: .45rem ;
  }

  .clinical-patients th:last-child,
  .clinical-patients td:last-child {
    padding-right: .95rem ;
  }

  .clinical-patients th:nth-child(1),
  .clinical-patients td:nth-child(1) {
    width: 24%;
  }

  .clinical-patients th:nth-child(2),
  .clinical-patients td:nth-child(2) {
    width: 39%;
  }

  .clinical-patients th:nth-child(3),
  .clinical-patients td:nth-child(3) {
    width: 17%;
  }

  .clinical-patients th:nth-child(4),
  .clinical-patients td:nth-child(4) {
    width: 20%;
    white-space: nowrap;
  }

  .clinical-patients td:nth-child(4) {
    text-align: center;
  }

  .clinical-status {
    min-width: 118px;
    max-width: 100%;
    white-space: nowrap;
  }

  .clinical-hero,
  .clinical-hero img,
  .clinical-hero-fallback {
    min-height: 225px;
    max-height: 285px;
    object-fit: cover;
    object-position: center center;
  }

  .clinical-meta .app-icon,
  .clinical-meta svg.app-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    color: var(--brand-primary, #087a68);
    stroke: currentColor;
    stroke-width: 1.9;
    fill: none;
  }

  .clinical-meta span {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
  }

}

@media (min-width: 1024px) and (max-width: 1320px) {
  .clinical-patients table {
    width: calc(100% - .35rem);
    margin-right: .35rem ;
  }

  .clinical-status {
    min-width: 96px;
    font-size: .68rem;
  }

  .clinical-hero,
  .clinical-hero img,
  .clinical-hero-fallback {
    min-height: 205px;
    max-height: 255px;
  }
}

/* Metadatos de ficha clínica: iconos específicos por tipo */
@media (min-width: 1024px) {
  .clinical-meta .app-icon-type-sex,
  .clinical-meta .app-icon-type-male,
  .clinical-meta .app-icon-type-female,
  .clinical-meta .app-icon-type-weight,
  .clinical-meta .app-icon-type-chip,
  .clinical-meta .app-icon-type-tag {
    width: 20px;
    height: 20px;
    min-width: 20px;
    color: var(--brand-primary, #087a68);
    stroke: currentColor;
    stroke-width: 1.9;
    fill: none;
  }
}

/* Veterinaria móvil: ficha primero y pacientes en carrusel */
@media (max-width: 720px) {
  .clinical-board {
    display: grid;
    grid-template-columns: 1fr;
    gap: .85rem;
  }

  .clinical-detail {
    order: 1 ;
    padding: .85rem;
    gap: .72rem;
  }

  .clinical-patients {
    order: 2 ;
    padding: .85rem;
  }

  .clinical-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: .48rem;
  }

  .clinical-filters input {
    grid-column: 1 / -1;
  }

  .clinical-filters input,
  .clinical-filters select {
    min-width: 0;
  }

  .clinical-hero,
  .clinical-hero img,
  .clinical-hero-fallback {
    min-height: 170px;
    max-height: 210px;
  }

  .clinical-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .42rem .55rem;
  }

  .clinical-meta span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .clinical-patients .clinical-table-wrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    border: 0;
    border-radius: 0;
    padding: .1rem .05rem .45rem;
    scroll-snap-type: x mandatory;
  }

  .clinical-patients .clinical-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .clinical-patients .clinical-table tbody {
    display: flex;
    gap: .7rem;
    width: fit-content;
    min-width: 0;
  }

  .clinical-patients .clinical-table tr {
    flex: 0 0 calc(100vw - 2.1rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem;
    max-width: 430px;
    padding: .78rem;
    border: 1px solid #e5ece9;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 36, 55, .08);
    scroll-snap-align: start;
  }

  .clinical-patients .clinical-table td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .clinical-patients .clinical-table td:nth-child(1),
  .clinical-patients .clinical-table td:nth-child(2) {
    grid-column: 1 / -1;
  }

  .clinical-patients .clinical-table td:nth-child(3) {
    grid-column: 1;
  }

  .clinical-patients .clinical-table td:nth-child(4) {
    grid-column: 2;
    align-self: end;
    justify-self: end ;
  }

  .clinical-patient {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: .58rem;
  }

  .clinical-case strong,
  .clinical-case small,
  .clinical-case em {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
    text-align: left;
  }

  html[data-gestfel-theme="dark"] .clinical-patients .clinical-table tr {
    border-color: var(--gf-line);
    background: linear-gradient(135deg, #13282e, #102229);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .24);
  }

  html[data-gestfel-theme="dark"] .clinical-patients .clinical-table td {
    background: transparent;
    color: var(--gf-text);
  }

  html[data-gestfel-theme="dark"] .clinical-patient small,
  html[data-gestfel-theme="dark"] .clinical-case small,
  html[data-gestfel-theme="dark"] .clinical-case em {
    color: var(--gf-muted);
  }

  .clinical-timeline-list {
    gap: .55rem;
  }


  .clinical-timeline-item strong {
    display: block;
    line-height: 1.18;
  }

  .clinical-timeline-item p,
  .clinical-timeline-item small {
    line-height: 1.24;
  }
}

/* Solicitudes, incidencias y footer público en móvil */
@media (max-width: 720px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  main,
  .app-main,
  .section,
  .card,
  .incident-detail-shell,
  .request-detail-shell,
  .status-report-detail-shell,
  .request-public-shell {
    min-width: 0;
    max-width: 100%;
  }

  .incident-detail-shell,
  .request-detail-shell,
  .status-report-detail-shell,
  .request-public-shell {
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
  }

  .incident-detail-head,
  .incident-detail-grid,
  .incident-lower-grid,
  .request-detail-main-grid,
  .request-lower-grid,
  .request-module-grid,
  .status-report-detail-shell + .grid.two,
  .request-detail-shell + .grid.two,
  .public-request-form,
  .status-report-detail-shell .incident-detail-grid,
  .status-report-detail-shell .incident-lower-grid {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }

  .incident-title-block,
  .incident-title-block > div,
  .incident-status-card,
  .incident-facts-card,
  .incident-summary-card,
  .incident-history-card,
  .incident-manage-card,
  .request-media-card,
  .incident-media-card {
    min-width: 0;
    max-width: 100%;
  }

  .incident-title-block h2,
  .incident-title-block p,
  .incident-breadcrumb,
  .incident-kicker,
  .incident-status-card strong,
  .incident-status-card small,
  .incident-status-card em,
  .incident-facts-card dd,
  .incident-summary-card,
  .incident-history-item,
  .incident-history-item strong,
  .incident-history-item time,
  .incident-history-item p {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .incident-breadcrumb {
    row-gap: .25rem ;
  }

  .incident-title-block h2 {
    font-size: clamp(1.22rem, 7vw, 1.55rem);
    line-height: 1.12;
  }

  .incident-title-block p:last-child {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .incident-status-card {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: .75rem;
  }

  .incident-detail-grid,
  .request-detail-main-grid,
  .status-report-detail-shell .incident-detail-grid {
    gap: .75rem;
  }

  .incident-media-card,
  .incident-media-card img,
  .incident-media-fallback,
  .request-media-card,
  .request-media-card img,
  .request-media-card .incident-media-fallback,
  .status-report-detail-shell .incident-media-card,
  .status-report-detail-shell .incident-media-card img,
  .status-report-detail-shell .incident-media-fallback {
    width: 100%;
    min-height: 180px;
    max-height: none;
  }

  .incident-media-card img,
  .request-media-card img,
  .status-report-detail-shell .incident-media-card img {
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
  }

  .incident-facts-card dl,
  .request-detail-shell .incident-facts-card dl,
  .status-report-detail-shell .incident-facts-card dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .incident-facts-card dl > div,
  .incident-facts-card dl > div:nth-child(2),
  .incident-facts-card dl > div:nth-child(3),
  .status-report-detail-shell .incident-facts-card dl > div:nth-child(3),
  .status-report-detail-shell .incident-facts-card dl > div:nth-child(4) {
    grid-column: auto;
  }

  .incident-summary-kpis {
    grid-template-columns: minmax(0, 1fr);
  }

  .status-reports-table,
  .requests-table {
    width: 100%;
    min-width: 0;
  }

  .page-head,
  .page-actions {
    min-width: 0;
    max-width: 100%;
  }

  .page-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
    width: 100%;
  }

  .page-actions .btn,
  .page-actions .button,
  .page-actions a {
    width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }

  .page-actions .btn:nth-child(3),
  .page-actions .button:nth-child(3),
  .page-actions a:nth-child(3) {
    grid-column: 1 / -1;
  }

  .status-reports-table td,
  .requests-table td {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .public-brand-footer,
  .footer.public-brand-footer,
  .site-footer.public-brand-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.05rem;
    width: 100%;
    max-width: 100%;
    padding: 1.65rem 1rem calc(1.65rem + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .public-brand-footer .footer-brand,
  .footer.public-brand-footer .footer-brand,
  .site-footer.public-brand-footer .footer-brand {
    max-width: 100%;
    align-items: flex-start;
  }

  .public-brand-footer .footer-brand strong,
  .footer.public-brand-footer .footer-brand strong,
  .site-footer.public-brand-footer .footer-brand strong,
  .public-brand-footer p,
  .footer.public-brand-footer p,
  .site-footer.public-brand-footer p,
  .public-brand-footer a,
  .footer.public-brand-footer a,
  .site-footer.public-brand-footer a {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .public-brand-footer .footer-brand img,
  .footer.public-brand-footer .footer-brand img,
  .site-footer.public-brand-footer .footer-brand img {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
  }
}

/* ==========================================================================
   Mejoras visuales consolidadas
   Antes se cargaban desde visual-enhancements.css; ahora forman parte del
   tema para evitar una capa adicional de sobrescrituras y otra petición HTTP.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Nav desktop — active más claro con indicador inferior
   -------------------------------------------------------------------------- */
.desktop-top-nav-row .desktop-top-nav a.active {
  background: color-mix(in srgb, var(--brand-primary) 12%, #fff);
  color: var(--brand-primary);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand-primary) 30%, transparent),
              0 3px 0 0 var(--brand-primary);
}

/* --------------------------------------------------------------------------
   2. Tablas pro-table — zebra suave + hover más cálido
   -------------------------------------------------------------------------- */
.pro-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--brand-primary) 3.5%, #fff);
}

.pro-table tbody tr:hover {
  background: color-mix(in srgb, var(--brand-primary) 9%, #fff);
}

.pro-table tbody tr.is-selected {
  background: color-mix(in srgb, var(--brand-primary) 9%, #fff);
  box-shadow: inset 4px 0 0 var(--brand-primary);
}

/* tabla clínica (vets.php) */
.clinical-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--brand-primary) 3.5%, #fff);
}

/* --------------------------------------------------------------------------
   3. Cabeceras de sección dentro de cards — separador izquierdo con acento
   -------------------------------------------------------------------------- */
.widget-head h2,
.clinical-patients h2,
.list-work-toolbar h2,
.cat-clinical-section h3,
.cat-clinical-aside h3,
.clinical-docs h3,
.clinical-timeline h3 {
  padding-left: .75rem;
  border-left: 3px solid var(--brand-primary);
  line-height: 1.1;
}

/* --------------------------------------------------------------------------
   4. KPI cards en módulo salud — números más grandes e impactantes
   -------------------------------------------------------------------------- */
.clinical-kpi strong {
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
  letter-spacing: -.02em;
}

/* --------------------------------------------------------------------------
   5. Cat profile facts — tarjetas de datos con más presencia
   -------------------------------------------------------------------------- */
.cat-profile-facts p {
  padding: .75rem .9rem;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff 0%, color-mix(in srgb, var(--brand-primary) 4%, #fff) 100%);
  border-color: color-mix(in srgb, var(--brand-primary) 15%, #e5ece9);
  transition: box-shadow .18s ease, border-color .18s ease;
}

.cat-profile-facts p:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 35%, transparent);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand-primary) 10%, transparent);
}

/* --------------------------------------------------------------------------
   6. Cards — sombra más profunda y border más suave
   -------------------------------------------------------------------------- */
.card {
  box-shadow: 0 2px 8px rgba(15, 36, 55, .06),
              0 12px 32px rgba(15, 36, 55, .07);
  border-color: color-mix(in srgb, var(--brand-primary) 12%, #e0e7e4);
}

/* --------------------------------------------------------------------------
   7. Botón primario — sombra de color + transición suave
   -------------------------------------------------------------------------- */
.btn-primary,
.button.primary {
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand-primary) 35%, transparent);
  transition: transform .16s ease, box-shadow .16s ease;
}

.btn-primary:hover,
.button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--brand-primary) 40%, transparent);
}

/* --------------------------------------------------------------------------
   8. Footer — más ligero en la app privada
   -------------------------------------------------------------------------- */
.app-footer {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand-primary) 92%, #000) 0%,
    color-mix(in srgb, var(--brand-primary) 80%, #000) 100%);
  margin-top: 2.5rem;
}

/* --------------------------------------------------------------------------
   9. Rediseño clínico y gatos - propuesta protectoras y ayuntamientos
   -------------------------------------------------------------------------- */
:root {
  --clinical-surface: #f6faf9;
  --clinical-panel: #ffffff;
  --clinical-line: color-mix(in srgb, var(--brand-primary) 16%, #dfe9e5);
  --clinical-muted: #5f6f7d;
  --clinical-ink: var(--brand-dark);
  --clinical-radius: 18px;
  --clinical-shadow: 0 16px 38px rgba(15, 36, 55, .07);
}

.cats-workspace,
.cat-profile-card,
.cat-clinical-section {
  --card-shadow-soft: 0 12px 32px rgba(15, 36, 55, .06);
}

.module-pro-head,
.page-head {
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,255,255,.82)),
    radial-gradient(circle at 96% 0%, color-mix(in srgb, var(--brand-primary) 12%, transparent), transparent 19rem);
  border-color: var(--clinical-line);
}

.module-pro-head {
  padding: clamp(1rem, 2vw, 1.35rem);
  border: 1px solid var(--clinical-line);
  border-radius: 26px;
  box-shadow: 0 18px 42px rgba(15, 36, 55, .055);
}

.module-pro-title h1,
.page-head h1 {
  letter-spacing: -.035em;
}

.module-pro-title p,
.page-head p,
.cat-profile-location,
.cat-clinical-head p {
  color: var(--clinical-muted);
}

.btn,
.button,
.list-filter-details > summary,
.colonies-list-action,
.clinical-timeline-edit {
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
}

.btn:active,
.button:active,
.list-filter-details > summary:active,
.colonies-list-action:active {
  transform: translateY(1px);
}

.cats-workspace .list-work-card {
  padding: clamp(.9rem, 1.6vw, 1.15rem);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.9)),
    var(--clinical-surface);
}

.cats-workspace .list-work-toolbar h2 {
  margin-bottom: .15rem;
  letter-spacing: -.025em;
}

.cats-workspace .list-search-form input {
  min-height: 46px;
  border-color: var(--clinical-line);
  border-radius: 15px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88);
}

.cats-workspace .list-search-form input:focus {
  border-color: color-mix(in srgb, var(--brand-primary) 50%, #dfe9e5);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-primary) 12%, transparent);
}

.cats-workspace .list-search-form button,
.cats-workspace .list-filter-details > summary {
  border-color: var(--clinical-line);
  box-shadow: 0 8px 18px rgba(15, 36, 55, .045);
}

.cats-workspace .list-filter-panel {
  border-color: var(--clinical-line);
  box-shadow: 0 26px 70px rgba(15, 36, 55, .16);
}

.cats-workspace .cat-selection-card {
  padding: clamp(.9rem, 1.7vw, 1.2rem);
  border-color: var(--clinical-line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, #fff 0%, color-mix(in srgb, var(--brand-primary) 3%, #fff) 100%);
  box-shadow: var(--card-shadow-soft);
}

.cats-workspace .cat-selection-photo,
.cat-profile-media .cat-photo {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 18%, #e5ece9);
  box-shadow: 0 14px 28px rgba(15, 36, 55, .08);
}

.cats-workspace .cat-selection-photo img,
.cat-profile-media .cat-photo {
  filter: saturate(.98) contrast(1.03);
}

.cats-workspace .cat-selection-title h2,
.cat-profile-info h2 {
  letter-spacing: -.035em;
}

.cats-workspace .species-pill,
.cats-workspace .health-pill,
.cat-profile-badges .badge,
.clinical-timeline-item .badge {
  border-radius: 999px;
  font-weight: 850;
}

.cats-workspace .cat-info-grid span,
.cats-workspace .cat-selection-notes article,
.cats-workspace .cat-detail-next-review,
.cats-workspace .health-summary,
.cat-profile-facts p,
.clinical-summary-kpi,
.cat-clinical-aside > section {
  border-color: var(--clinical-line);
  background: linear-gradient(145deg, #fff 0%, color-mix(in srgb, var(--brand-primary) 3.5%, #fff) 100%);
}

.cats-workspace .cat-info-grid span {
  align-content: start;
  min-height: 76px;
}

.cats-workspace .cat-info-grid strong,
.cat-profile-facts p,
.clinical-summary-kpi > strong {
  font-variant-numeric: tabular-nums;
}

.cats-workspace .cat-selection-notes article {
  box-shadow: none;
}

.cats-workspace .cat-selection-aside .colonies-list-action {
  border-radius: 16px;
  border-color: color-mix(in srgb, var(--brand-primary) 20%, #e5ece9);
  background: #fff;
  color: var(--clinical-ink);
  font-weight: 850;
}

.cats-workspace .cat-selection-aside .colonies-list-action:hover,
.clinical-timeline-edit:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 45%, #e5ece9);
  background: color-mix(in srgb, var(--brand-primary) 6%, #fff);
  color: var(--brand-primary);
}

.cats-workspace .pro-table-wrap {
  border-radius: 20px;
  border: 1px solid var(--clinical-line);
  background: #fff;
}

.cats-workspace .cats-pro-table {
  border-collapse: separate;
  border-spacing: 0;
}

.cats-workspace .cats-pro-table thead th {
  background: color-mix(in srgb, var(--brand-primary) 7%, #fff);
  color: #40515f;
  font-size: .76rem;
  letter-spacing: .01em;
}

.cats-workspace .cats-pro-table tbody tr {
  transition: background-color .16s ease, box-shadow .16s ease;
}

.cats-workspace .cats-pro-table td {
  vertical-align: middle;
}

.cat-profile-card {
  padding: clamp(.95rem, 1.7vw, 1.2rem);
  border-color: var(--clinical-line);
  background:
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(255,255,255,.92)),
    var(--clinical-surface);
}

.cat-profile-media .actions {
  border-top-color: var(--clinical-line);
}

.cat-profile-media .actions .btn,
.cat-profile-media .actions .button,
.cat-profile-media .actions button {
  border-radius: 14px;
}

.cat-profile-facts p {
  box-shadow: none;
}

.cat-profile-facts p:hover {
  transform: translateY(-1px);
}

.cat-clinical-section {
  padding: clamp(.95rem, 1.8vw, 1.25rem);
  border-color: var(--clinical-line);
  border-radius: 26px;
  background:
    linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--brand-primary) 2.5%, #fff) 100%);
}

.cat-clinical-head {
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--clinical-line);
}

.cat-clinical-head h2 {
  margin-top: .05rem;
  letter-spacing: -.03em;
}

.cat-clinical-summary {
  gap: .7rem;
}

.clinical-summary-kpi {
  min-height: 86px;
  box-shadow: none;
}

.clinical-summary-kpi > .app-icon,
.clinical-summary-kpi > svg,
.clinical-summary-euro,
.clinical-summary-kpi--status > i {
  background: color-mix(in srgb, var(--brand-primary) 9%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-primary) 14%, transparent);
}

.clinical-timeline {
  padding: .85rem;
  border: 1px solid var(--clinical-line);
  border-radius: 20px;
  background: #fff;
}

.clinical-timeline-list::before {
  left: 28px;
  width: 2px;
  background: color-mix(in srgb, var(--brand-primary) 22%, #dbe7e3);
  box-shadow: none;
}

.clinical-timeline-item {
  grid-template-columns: 56px 112px minmax(0, 1fr) minmax(170px, .36fr);
  gap: .8rem;
  padding: .9rem .95rem;
  border-left-width: 1px;
  border-color: var(--clinical-line);
  border-radius: 18px;
  box-shadow: none;
}

.clinical-timeline-item:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 34%, #dfe9e5);
  box-shadow: 0 12px 26px rgba(15, 36, 55, .06);
}

.clinical-timeline-item > span:first-child {
  width: 48px;
  height: 48px;
  box-shadow: 0 0 0 5px #fff, 0 0 0 7px color-mix(in srgb, var(--brand-primary) 16%, transparent);
}

.clinical-timeline-item time {
  padding-top: .18rem;
  color: #40515f;
  font-size: .94rem;
}

.clinical-timeline-item p,
.clinical-timeline-item small,
.cat-clinical-notes p {
  color: var(--clinical-muted);
}

.clinical-timeline-edit {
  padding: .34rem .6rem;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 20%, #dfe9e5);
  border-radius: 999px;
  background: #fff;
}

.cat-clinical-aside {
  position: sticky;
  top: 92px;
}

.cat-clinical-aside > section {
  box-shadow: none;
}

.clinical-doc-thumb {
  border-color: var(--clinical-line);
  background: color-mix(in srgb, var(--brand-primary) 3%, #fff);
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .button,
  .list-filter-details > summary,
  .colonies-list-action,
  .clinical-timeline-edit,
  .cats-workspace .cats-pro-table tbody tr,
  .cat-profile-facts p {
    transition: none;
  }

  .btn:active,
  .button:active,
  .list-filter-details > summary:active,
  .colonies-list-action:active,
  .cat-profile-facts p:hover {
    transform: none;
  }
}

@media (max-width: 1180px) {
  .cat-clinical-aside {
    position: static;
  }
}

@media (max-width: 820px) {
  .module-pro-head {
    padding: .9rem;
    border-radius: 22px;
  }

  .module-pro-title {
    gap: .75rem;
  }

  .module-pro-icon {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 17px;
  }

  .cats-workspace .list-work-card {
    padding: .75rem;
    border-radius: 22px;
  }

  .cats-workspace .cat-selection-card {
    border-radius: 22px;
  }

  .cats-workspace .cat-selection-title h2 {
    max-width: 100%;
  }

  .cats-workspace .cat-info-grid span {
    min-height: 64px;
  }
}

@media (max-width: 720px) {
  .page-head {
    padding: .95rem;
    border-radius: 22px;
  }

  .page-head .actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: .45rem;
  }

  .page-head .actions .btn,
  .page-head .actions .button,
  .page-head .actions details,
  .page-head .actions summary {
    width: 100%;
  }

  .cat-profile-card {
    padding: .75rem;
    border-radius: 22px;
  }

  .grid.two.cat-profile-grid {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .cat-profile-media .cat-photo {
    width: 96px;
    height: 96px;
    border-radius: 16px;
  }

  .cat-profile-info h2 {
    font-size: clamp(1.35rem, 7.2vw, 1.85rem);
  }

  .cat-profile-location {
    font-size: .88rem;
  }

  .cat-profile-media .actions {
    padding-top: .6rem;
  }

  .cat-clinical-section {
    padding: .75rem;
    border-radius: 22px;
  }

  .cat-clinical-head {
    display: grid;
    gap: .7rem;
  }

  .cat-clinical-head .btn {
    width: 100%;
  }

  .cat-clinical-summary {
    grid-template-columns: 1fr 1fr;
  }

  .clinical-summary-kpi {
    min-height: 70px;
    border-radius: 15px;
  }

  .clinical-timeline {
    padding: .65rem;
    border-radius: 18px;
  }

  .clinical-timeline-list::before {
    left: 24px;
  }

  .clinical-timeline-item {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: .45rem .6rem;
    padding: .72rem;
  }

  .clinical-timeline-item > .clinical-event-icon,
  .clinical-timeline-item > span:first-child {
    grid-column: 1;
    grid-row: 1 / 4;
    width: 40px;
    height: 40px;
    align-self: start;
  }

  .clinical-timeline-item time,
  .clinical-timeline-item div,
  .clinical-timeline-item small,
  .clinical-timeline-edit {
    grid-column: 2;
  }

  .clinical-timeline-item time {
    grid-row: 1;
    padding-top: 0;
    width: fit-content;
    max-width: 100%;
    padding: .18rem .42rem;
    border: 1px solid color-mix(in srgb, var(--brand-primary) 16%, #dfe9e5);
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand-primary) 5%, #fff);
    color: #526270;
    font-size: .72rem;
    line-height: 1.1;
    white-space: nowrap;
  }

  .clinical-timeline-item div {
    grid-row: 2;
  }

  .clinical-timeline-item small {
    grid-row: 3;
  }

  .clinical-timeline-edit {
    grid-row: 4;
  }

  .clinical-timeline-item strong {
    display: flex;
    gap: .35rem;
  }

  .cat-clinical-aside > section {
    padding: .7rem;
    border-radius: 16px;
  }
}

@media (max-width: 390px) {
  .cat-clinical-summary {
    grid-template-columns: 1fr;
  }

  .cats-workspace .cat-selection-aside {
    grid-template-columns: 1fr;
  }
}
/* DV8 operational preview: higher contrast, denser modules, stronger hierarchy. */
:root {
  --dv8-ink: #132028;
  --dv8-muted: #536471;
  --dv8-line: #cbd9d6;
  --dv8-line-strong: #aabfba;
  --dv8-surface: #f4f8f7;
  --dv8-panel: #ffffff;
  --dv8-panel-2: #eef5f3;
  --dv8-accent: #087968;
  --dv8-accent-2: #d25f2b;
  --dv8-critical: #b42318;
  --dv8-radius: 10px;
  --dv8-shadow: 0 14px 34px rgba(19, 32, 40, .08);
}

body.app-body {
  background: linear-gradient(180deg, #fbfdfc 0%, var(--dv8-surface) 48%, #edf4f2 100%);
  color: var(--dv8-ink);
}

.app-main {
  gap: .95rem;
}

.app-top,
.desktop-top-nav-row {
  border-color: rgba(19, 32, 40, .12);
}

.app-top {
  box-shadow: 0 10px 28px rgba(19, 32, 40, .07);
}

.desktop-top-nav-row {
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(14px);
}

.desktop-top-nav a,
.desktop-top-nav button,
.mobile-bottom-nav a {
  border-radius: 8px;
}

.page-head.dashboard-pro-head {
  position: relative;
  overflow: hidden;
  align-items: stretch;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--dv8-line);
  border-left: 5px solid var(--dv8-accent);
  border-radius: var(--dv8-radius);
  background:
    linear-gradient(120deg, rgba(8, 121, 104, .12), transparent 38%),
    linear-gradient(180deg, #fff, #f8fbfa);
  box-shadow: var(--dv8-shadow);
}

.page-head.dashboard-pro-head h1 {
  max-width: 12ch;
  font-size: clamp(2rem, 4.8vw, 4rem);
  line-height: .92;
  letter-spacing: 0;
}

.page-head.dashboard-pro-head p {
  max-width: 62ch;
  margin-top: .45rem;
  color: var(--dv8-muted);
  font-size: .94rem;
  line-height: 1.45;
}

.dashboard-pro-head .page-actions {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  gap: .45rem;
}

.dashboard-pro-head .btn,
.dashboard-pro-head .button {
  min-height: 38px;
  border-radius: 8px;
  font-size: .88rem;
}

.notice-board.dashboard-fixed-panel,
.task-alert-panel.dashboard-fixed-panel,
.dashboard-priority-panel.dashboard-fixed-panel,
.dashboard-toolbar.dashboard-fixed-panel {
  border: 1px solid var(--dv8-line);
  border-radius: var(--dv8-radius);
  background: var(--dv8-panel);
  box-shadow: 0 10px 24px rgba(19, 32, 40, .06);
}

.dashboard-edit-help[hidden] {
  display: none;
}

.task-alert-panel.dashboard-fixed-panel {
  padding: .75rem;
}

.dashboard-priority-panel.dashboard-fixed-panel {
  padding: .8rem;
}

.dashboard-priority-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .65rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--dv8-line);
}

.dashboard-priority-head-actions {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  flex-shrink: 0;
}

.dashboard-priority-head h2 {
  margin: 0 0 .38rem;
  font-size: 1rem;
  letter-spacing: 0;
}

.dashboard-priority-head > a,
.dashboard-priority-head-actions > a,
.dashboard-priority-item > a,
.dashboard-priority-actions a,
.dashboard-priority-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: .38rem .72rem;
  border: 1px solid var(--dv8-line);
  border-radius: 999px;
  background: #fff;
  color: var(--dv8-ink);
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(19, 32, 40, .045);
}

.dashboard-priority-toggle {
  display: none;
  cursor: pointer;
}

.dashboard-priority-summary {
  display: flex;
  flex-wrap: wrap;
  gap: .32rem;
}

.dashboard-priority-chip {
  display: inline-flex;
  align-items: center;
  gap: .24rem;
  min-height: 24px;
  padding: .16rem .48rem;
  border: 1px solid var(--dv8-line);
  border-radius: 999px;
  color: var(--dv8-muted);
  background: var(--dv8-panel-2);
  font-size: .76rem;
  font-weight: 850;
}

.dashboard-priority-chip b {
  color: var(--dv8-ink);
  font-variant-numeric: tabular-nums;
}

.dashboard-priority-chip--expired {
  border-color: rgba(190, 18, 60, .22);
  background: rgba(255, 241, 242, .92);
  color: #9f1239;
}

.dashboard-priority-chip--soon {
  border-color: rgba(180, 83, 9, .24);
  background: rgba(255, 251, 235, .95);
  color: #92400e;
}

.dashboard-priority-chip--open {
  border-color: rgba(8, 121, 104, .2);
  background: rgba(236, 253, 245, .8);
  color: #0f766e;
}

.dashboard-priority-list {
  display: grid;
  gap: .48rem;
}

.vet-task-group-list {
  gap: .7rem;
}

.vet-task-summary {
  align-items: center;
}

.vet-task-category-chip {
  cursor: pointer;
  font: inherit;
}

.vet-task-category-chip.is-active {
  border-color: color-mix(in srgb, var(--brand-primary) 40%, var(--dv8-line));
  background: color-mix(in srgb, var(--brand-primary) 13%, #fff);
  color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 12%, transparent);
}

.vet-task-category-chip.is-active b {
  color: var(--brand-primary);
}

.vet-task-group {
  display: grid;
  gap: .42rem;
}

.vet-task-group[hidden] {
  display: none !important;
}

.vet-task-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .2rem .12rem 0;
}

.vet-task-group-head h3 {
  margin: 0;
  color: var(--dv8-ink);
  font-size: .86rem;
  font-weight: 950;
  letter-spacing: 0;
}

.vet-task-group-head span {
  color: var(--dv8-muted);
  font-size: .74rem;
  font-weight: 850;
  white-space: nowrap;
}

.vet-task-list {
  display: grid;
  gap: .42rem;
}

.dashboard-priority-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(230px, .82fr) auto;
  align-items: center;
  gap: .72rem;
  min-height: 70px;
  padding: .62rem .66rem .62rem .86rem;
  border: 1px solid color-mix(in srgb, var(--dv8-line) 82%, #fff);
  border-left: 5px solid var(--gf-accent);
  border-radius: 10px;
  background: #fff;
}

.dashboard-priority-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: inherit;
  opacity: .5;
  pointer-events: none;
}

.dashboard-priority-item:hover {
  border-color: var(--dv8-line-strong);
  box-shadow: 0 12px 24px rgba(19, 32, 40, .08);
}

.dashboard-priority-main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .22rem .5rem;
  min-width: 0;
}

.dashboard-priority-main strong {
  min-width: 0;
  overflow: hidden;
  color: var(--dv8-ink);
  font-size: .98rem;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-priority-main em {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  color: var(--dv8-muted);
  font-size: .8rem;
  font-style: normal;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-priority-state {
  grid-row: 1 / span 2;
  align-self: center;
  min-width: 74px;
  padding: .18rem .46rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

.dashboard-priority-meta {
  position: relative;
  z-index: 1;
  color: var(--dv8-muted);
  font-size: .82rem;
  font-weight: 780;
  line-height: 1.25;
}

.dashboard-priority-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: .35rem;
  justify-content: flex-end;
}

.dashboard-priority-actions.vet-task-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: .28rem;
}

.dashboard-priority-actions.vet-task-actions a {
  min-height: 30px;
  padding: .28rem .58rem;
  border-radius: 999px;
  font-size: .76rem;
  line-height: 1;
  box-shadow: none;
}

.dashboard-priority-item--expired {
  border-left-color: #be123c;
  background: linear-gradient(90deg, rgba(255, 241, 242, .95), #fff 44%);
}

.dashboard-priority-item--expired::before {
  background: linear-gradient(90deg, rgba(244, 63, 94, .14), transparent);
}

.dashboard-priority-item--expired .dashboard-priority-state {
  color: #be123c;
  background: #fff1f2;
}

.dashboard-priority-item--soon {
  border-left-color: #d97706;
  background: linear-gradient(90deg, rgba(255, 251, 235, .96), #fff 44%);
}

.dashboard-priority-item--soon::before {
  background: linear-gradient(90deg, rgba(245, 158, 11, .14), transparent);
}

.dashboard-priority-item--soon .dashboard-priority-state {
  color: #b45309;
  background: #fffbeb;
}

.dashboard-priority-item--open {
  border-left-color: #0f9486;
  background: linear-gradient(90deg, rgba(236, 253, 245, .86), #fff 44%);
}

.dashboard-priority-item--open::before {
  background: linear-gradient(90deg, rgba(20, 184, 166, .1), transparent);
}

.dashboard-priority-item--open .dashboard-priority-state {
  color: #0f766e;
  background: #ecfdf5;
}

.task-alert-panel .widget-head {
  margin-bottom: .55rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--dv8-line);
}

.task-alert-panel .widget-head h2 {
  font-size: .98rem;
  letter-spacing: 0;
}

.task-alert-list {
  display: grid;
  gap: .45rem;
}

.task-alert-item {
  position: relative;
  display: grid;
  gap: .2rem;
  padding: .62rem .72rem .62rem .92rem;
  border: 1px solid color-mix(in srgb, var(--dv8-line) 82%, #fff);
  border-left: 4px solid var(--dv8-accent-2);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fbfcfc);
}

.task-alert-item:hover {
  border-color: var(--dv8-line-strong);
  background: #fff;
  box-shadow: 0 10px 22px rgba(19, 32, 40, .08);
}

.task-alert-item strong {
  color: var(--dv8-ink);
  font-size: .94rem;
  line-height: 1.2;
}

.task-alert-detail,
.task-alert-item span,
.task-alert-item small {
  color: var(--dv8-muted);
  font-size: .8rem;
  line-height: 1.25;
}

.dashboard-command-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: .55rem;
  padding: .65rem;
  border: 1px solid var(--dv8-line);
  border-radius: var(--dv8-radius);
  background: #fff;
  box-shadow: var(--dv8-shadow);
}

.dashboard-command-kpis .kpi.card {
  min-width: 0;
  min-height: 112px;
  padding: .82rem .9rem;
  border: 1px solid var(--dv8-line);
  border-radius: 8px;
  background: var(--dv8-panel-2);
  box-shadow: none;
  overflow: hidden;
}

.dashboard-command-kpis .kpi-icon,
.dashboard-command-kpis svg.kpi-icon {
  width: 58px;
  height: 58px;
}

.dashboard-command-kpis .kpi.card strong {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: .14em;
  color: var(--gf-accent);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.52rem, 1.55vw, 2rem);
  line-height: .95;
  white-space: nowrap;
}

.dashboard-command-kpis .kpi.card strong b {
  min-width: 0;
  overflow: visible;
  font: inherit;
  text-overflow: clip;
}

.dashboard-command-kpis .kpi.card strong em {
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--gf-accent) 84%, var(--gf-muted));
  font-size: .72em;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.dashboard-command-kpis .kpi.card span {
  display: block;
  min-width: 0;
  color: var(--dv8-muted);
  font-size: clamp(.96rem, .92vw, 1.1rem);
  line-height: 1.06;
  font-weight: 850;
  text-wrap: balance;
}

.dashboard-dv8-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: .75rem;
  align-items: start;
}

.dashboard-dv8-grid .dashboard-widget {
  overflow: hidden;
  border: 1px solid var(--dv8-line);
  border-radius: var(--dv8-radius);
  background: var(--dv8-panel);
  box-shadow: 0 12px 28px rgba(19, 32, 40, .07);
}

.dashboard-dv8-grid .dashboard-widget-titlebar {
  min-height: 52px;
  padding: .7rem .78rem;
  border-bottom: 1px solid var(--dv8-line);
  background:
    linear-gradient(90deg, rgba(8, 121, 104, .1), transparent 55%),
    #fbfdfc;
}

.dashboard-dv8-grid .dashboard-widget-titlebar h2 {
  color: var(--dv8-ink);
  font-size: .98rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.dashboard-dv8-grid .dashboard-widget-titlebar p,
.dashboard-dv8-grid .muted {
  max-width: 72ch;
  color: var(--dv8-muted);
  font-size: .8rem;
  line-height: 1.35;
}

.dashboard-dv8-grid .dashboard-size-controls button,
.dashboard-dv8-grid .dashboard-move-controls button {
  border-radius: 6px;
}

.dashboard-dv8-grid .table-wrap {
  max-height: 420px;
  border: 0;
  border-radius: 0;
}

.dashboard-dv8-grid .table {
  font-size: .84rem;
}

.dashboard-dv8-grid .table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: .55rem .65rem;
  background: var(--dv8-ink);
  color: #fff;
  font-size: .72rem;
  letter-spacing: 0;
}

.dashboard-dv8-grid .table td {
  padding: .56rem .65rem;
  border-bottom: 1px solid color-mix(in srgb, var(--dv8-line) 72%, #fff);
  vertical-align: top;
}

.dashboard-dv8-grid .table tr:hover td {
  background: #f7fbfa;
}

.dashboard-widget[data-widget-id="monthly-evolution"] {
  background: #111c22;
  color: #fff;
}

.dashboard-widget[data-widget-id="monthly-evolution"] .dashboard-widget-titlebar {
  border-bottom-color: rgba(255, 255, 255, .12);
  background: linear-gradient(135deg, #132028, #17342f);
}

.dashboard-widget[data-widget-id="monthly-evolution"] h2,
.dashboard-widget[data-widget-id="monthly-evolution"] p {
  color: #fff;
}

.dashboard-widget[data-widget-id="monthly-evolution"] .chart-canvas {
  min-height: 300px;
  padding: .8rem;
}

.dashboard-widget[data-widget-id="recent-alerts"],
.dashboard-widget[data-widget-id="tasks"],
.dashboard-widget[data-widget-id="quick-actions"] {
  background: #fbfdfc;
}

.dashboard-widget[data-widget-id="recent-alerts"] > p,
.dashboard-widget[data-widget-id="tasks"] > p {
  margin: 0;
  padding: .72rem .82rem;
  border-bottom: 1px solid var(--dv8-line);
}

.dashboard-widget[data-widget-id="recent-alerts"] > p:hover,
.dashboard-widget[data-widget-id="tasks"] > p:hover {
  background: #fff;
}

.dashboard-widget[data-widget-id="tasks"] > p:last-child,
.dashboard-widget[data-widget-id="recent-alerts"] > p:last-child {
  border-bottom: 0;
}

.dashboard-widget[data-widget-id="quick-actions"] .actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
  padding: .75rem;
}

.dashboard-widget[data-widget-id="quick-actions"] .btn {
  justify-content: flex-start;
  min-height: 42px;
  border-radius: 8px;
  background: #fff;
}

.dashboard-widget[data-widget-id="health-reminders"] {
  border-top: 4px solid var(--dv8-critical);
}

.dashboard-widget[data-widget-id="costs"] {
  border-top: 4px solid var(--dv8-accent);
}

.cats-workspace .list-work-card,
.cat-profile-card,
.cat-clinical-section,
.clinical-page .card {
  border-radius: var(--dv8-radius);
  border-color: var(--dv8-line);
  box-shadow: var(--dv8-shadow);
}

.module-pro-head,
.clinical-head,
.cat-profile-card {
  border-left: 5px solid var(--dv8-accent);
  background:
    linear-gradient(120deg, rgba(8, 121, 104, .11), transparent 40%),
    #fff;
}

.cats-workspace .cat-selection-card {
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr) minmax(220px, .55fr);
  gap: .85rem;
  padding: .75rem;
  border-radius: var(--dv8-radius);
  border-color: var(--dv8-line);
  background: #fff;
}

.cats-workspace .cat-selection-photo {
  min-height: 188px;
  border-radius: 8px;
  background: var(--dv8-ink);
}

.cats-workspace .cat-selection-photo img,
.cats-workspace .cat-selection-photo__fallback {
  border-radius: 8px;
}

.cats-workspace .cat-selection-title h2,
.cat-profile-info h2,
.cat-clinical-head h2 {
  color: var(--dv8-ink);
  letter-spacing: 0;
}

.cats-workspace .cat-info-grid {
  gap: .45rem;
}

.cats-workspace .cat-info-grid span,
.cat-profile-facts p,
.clinical-summary-kpi,
.cat-clinical-aside > section {
  border-color: var(--dv8-line);
  border-radius: 8px;
  background: #f9fcfb;
}

.cats-workspace .cat-selection-notes {
  gap: .45rem;
}

.cats-workspace .cat-selection-notes article {
  min-height: 74px;
  border-radius: 8px;
  background: #fff;
}

.cats-workspace .cat-selection-aside {
  align-content: start;
  gap: .45rem;
  padding-left: .75rem;
  border-left: 1px solid var(--dv8-line);
}

.cat-profile-card {
  padding: .9rem;
}

.grid.two.cat-profile-grid {
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  gap: 1rem;
}

.cat-profile-media .cat-photo {
  border-radius: 8px;
}

.cat-profile-badges .badge,
.clinical-status,
.badge {
  border-radius: 999px;
}

.cat-clinical-section {
  padding: .9rem;
  background:
    linear-gradient(180deg, #fff, #f9fcfb);
}

.cat-clinical-head {
  padding-bottom: .72rem;
}

.cat-clinical-summary {
  grid-template-columns: repeat(4, minmax(132px, 1fr));
  gap: .55rem;
}

.clinical-summary-kpi {
  min-height: 84px;
  padding: .65rem;
}

.clinical-summary-kpi > strong {
  font-size: 1.35rem;
  line-height: 1;
}

.clinical-summary-kpi > .clinical-summary-date {
  font-size: clamp(.92rem, 2.8vw, 1.08rem);
}

.clinical-timeline {
  border-radius: var(--dv8-radius);
  background: #fff;
}

.clinical-timeline-list {
  gap: .55rem;
}

.clinical-timeline-list::before {
  left: 30px;
  background: linear-gradient(180deg, var(--dv8-accent), var(--dv8-line));
}

.clinical-timeline-item {
  grid-template-columns: 52px 112px minmax(0, 1fr) minmax(92px, auto);
  gap: .55rem;
  padding: .68rem;
  border-radius: 8px;
  border-color: var(--dv8-line);
  background: #fbfdfc;
}

.clinical-timeline-item:hover {
  background: #fff;
  border-color: var(--dv8-line-strong);
}

.clinical-timeline-item > .clinical-event-icon,
.clinical-timeline-item > span:first-child {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.clinical-timeline-item time {
  color: var(--dv8-muted);
  font-size: .77rem;
}

@media (min-width: 821px) {
  .clinical-timeline-item {
    grid-template-columns: 52px max-content minmax(0, 1fr);
    column-gap: .8rem;
  }

  .clinical-timeline-item small {
    grid-column: 3;
    max-width: none;
  }
}

.clinical-timeline-edit,
.cats-workspace .cat-selection-aside .colonies-list-action,
.cat-profile-media .actions .btn,
.cat-profile-media .actions .button {
  border-radius: 8px;
}

@media (prefers-reduced-motion: no-preference) {
  .dashboard-pro-head,
  .dashboard-command-kpis,
  .task-alert-panel.dashboard-fixed-panel,
  .dashboard-priority-panel.dashboard-fixed-panel,
  .dashboard-dv8-grid .dashboard-widget,
  .cats-workspace .cat-selection-card,
  .cat-profile-card,
  .cat-clinical-section,
  .clinical-board .card {
    animation: dv8-rise .52s cubic-bezier(.16, 1, .3, 1) both;
  }

  .dashboard-dv8-grid .dashboard-widget:nth-child(2),
  .cats-workspace .cat-selection-card:nth-child(2) {
    animation-delay: .04s;
  }

  .dashboard-dv8-grid .dashboard-widget:nth-child(3),
  .cats-workspace .cat-selection-card:nth-child(3) {
    animation-delay: .08s;
  }

  .dashboard-dv8-grid .dashboard-widget:nth-child(4),
  .cats-workspace .cat-selection-card:nth-child(4) {
    animation-delay: .12s;
  }

  .dashboard-dv8-grid .dashboard-widget,
  .task-alert-item,
  .dashboard-priority-item,
  .cats-workspace .cat-selection-card,
  .clinical-timeline-item,
  .cat-profile-facts p,
  .btn,
  .button {
    transition:
      transform .22s ease,
      box-shadow .22s ease,
      border-color .22s ease,
      background-color .22s ease;
  }

  .dashboard-dv8-grid .dashboard-widget:hover,
  .cats-workspace .cat-selection-card:hover,
  .cat-profile-facts p:hover {
    transform: translateY(-2px);
  }

  .btn:active,
  .button:active,
  .task-alert-item:active,
  .dashboard-priority-item:active,
  .cats-workspace .cat-selection-card:active {
    transform: translateY(1px) scale(.995);
  }

  @keyframes dv8-rise {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-pro-head,
  .dashboard-command-kpis,
  .task-alert-panel.dashboard-fixed-panel,
  .dashboard-priority-panel.dashboard-fixed-panel,
  .dashboard-dv8-grid .dashboard-widget,
  .cats-workspace .cat-selection-card,
  .cat-profile-card,
  .cat-clinical-section,
  .clinical-board .card {
    animation: none;
  }
}

@media (max-width: 1280px) {
  .dashboard-command-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cats-workspace .cat-selection-card {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .cats-workspace .cat-selection-aside {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 0;
    padding-top: .75rem;
    border-left: 0;
    border-top: 1px solid var(--dv8-line);
  }
}

@media (max-width: 900px) {
  .page-head.dashboard-pro-head {
    display: grid;
  }

  .dashboard-pro-head .page-actions {
    align-self: stretch;
    grid-template-columns: 1fr;
  }

  .dashboard-command-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-dv8-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-dv8-grid .dashboard-widget,
  .dashboard-dv8-grid .dashboard-widget[data-size] {
    grid-column: 1 / -1;
  }

  .grid.two.cat-profile-grid {
    grid-template-columns: 136px minmax(0, 1fr);
  }

  .cat-clinical-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clinical-timeline-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .dashboard-priority-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .dashboard-priority-main {
    grid-column: 1 / -1;
  }

  .dashboard-priority-meta {
    grid-column: 1;
  }
}

@media (max-width: 680px) {
  .app-main {
    gap: .7rem;
  }

  .page-head.dashboard-pro-head h1 {
    max-width: none;
    font-size: clamp(1.9rem, 11vw, 3rem);
  }

  .dashboard-command-kpis {
    gap: .42rem;
    padding: .5rem;
  }

  .dashboard-command-kpis .kpi.card {
    min-height: 98px;
    padding: .62rem;
  }

  .dashboard-dv8-grid .dashboard-widget-titlebar {
    align-items: flex-start;
    gap: .45rem;
  }

  .dashboard-widget[data-widget-id="quick-actions"] .actions {
    grid-template-columns: 1fr;
  }

  .dashboard-priority-panel.dashboard-fixed-panel {
    padding: .68rem;
  }

  .dashboard-priority-head {
    display: grid;
    gap: .55rem;
  }

  .dashboard-priority-head-actions {
    justify-self: start;
    flex-wrap: wrap;
  }

  .dashboard-priority-toggle {
    display: inline-flex;
  }

  .dashboard-priority-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: .52rem;
    min-height: 0;
    padding: .7rem .72rem .72rem .86rem;
  }

  .dashboard-priority-main {
    grid-template-columns: minmax(0, 1fr);
    gap: .34rem;
  }

  .dashboard-priority-state {
    grid-row: auto;
    justify-self: start;
    min-width: 0;
  }

  .dashboard-priority-main em {
    grid-column: auto;
    white-space: normal;
  }

  .dashboard-priority-main strong {
    white-space: normal;
  }

  .dashboard-priority-meta {
    grid-column: auto;
    font-size: .78rem;
  }

  .dashboard-priority-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .dashboard-priority-panel.is-collapsed .dashboard-priority-list {
    display: none;
  }

  .dashboard-priority-panel.is-collapsed .dashboard-priority-head {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
  }

  .cats-workspace .cat-selection-card {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: .6rem;
  }

  .cats-workspace .cat-selection-photo {
    min-height: 92px;
  }

  .cats-workspace .cat-selection-main {
    min-width: 0;
  }

  .cats-workspace .cat-selection-aside,
  .cats-workspace .cat-selection-notes {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  .grid.two.cat-profile-grid {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .cat-profile-card,
  .cat-clinical-section {
    padding: .65rem;
  }

  .cat-clinical-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .dashboard-command-kpis {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 410px) {
  .dashboard-command-kpis,
  .cat-clinical-summary {
    grid-template-columns: 1fr;
  }

  .cats-workspace .cat-selection-card {
    grid-template-columns: 1fr;
  }

  .cats-workspace .cat-selection-photo {
    min-height: 170px;
  }
}

/* System-wide visual layer: homogeneous module theme and user theme switcher. */
:root,
html[data-gestfel-theme="light"] {
  --gf-page-bg: #f4faf8;
  --gf-page-grid: rgba(8, 121, 104, .055);
  --gf-panel: #ffffff;
  --gf-panel-soft: #f7fbfa;
  --gf-panel-tint: color-mix(in srgb, var(--brand-primary) 7%, #ffffff);
  --gf-line: color-mix(in srgb, var(--brand-primary) 18%, #dbe7e4);
  --gf-line-strong: color-mix(in srgb, var(--brand-primary) 34%, #cddbd8);
  --gf-text: var(--brand-dark);
  --gf-muted: #637482;
  --gf-accent: var(--brand-primary);
  --gf-accent-soft: color-mix(in srgb, var(--brand-primary) 12%, #ffffff);
  --gf-danger: #b42318;
  --gf-warning: #b7791f;
  --gf-radius-panel: 14px;
  --gf-radius-inner: 9px;
  --gf-shadow: 0 14px 34px rgba(15, 36, 55, .07);
  --gf-shadow-soft: 0 8px 18px rgba(15, 36, 55, .055);
}

html[data-gestfel-theme="dark"] {
  --gf-page-bg: #101f24;
  --gf-page-grid: rgba(127, 220, 204, .08);
  --gf-panel: #15272d;
  --gf-panel-soft: #1b3036;
  --gf-panel-tint: color-mix(in srgb, var(--brand-primary) 20%, #14262b);
  --gf-line: rgba(157, 204, 197, .24);
  --gf-line-strong: rgba(157, 204, 197, .42);
  --gf-text: #eefaf7;
  --gf-muted: #a7bdb8;
  --gf-accent: #6fd6c7;
  --gf-accent-soft: rgba(111, 214, 199, .13);
  --gf-shadow: 0 18px 34px rgba(0, 0, 0, .34);
  --gf-shadow-soft: 0 10px 18px rgba(0, 0, 0, .22);
}

body.app-body,
body.public-page,
.login-page {
  background: linear-gradient(180deg, #ffffff 0%, var(--gf-page-bg) 56%, #eaf5f2 100%);
  color: var(--gf-text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 34px;
  padding: .42rem .62rem;
  border: 1px solid var(--gf-line-strong);
  border-radius: 999px;
  background: var(--gf-panel);
  color: var(--gf-accent);
  font: inherit;
  font-size: .82rem;
  font-weight: 850;
  line-height: 1;
  box-shadow: var(--gf-shadow-soft);
  cursor: pointer;
  white-space: nowrap;
}

.theme-toggle-icon,
.theme-toggle svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  padding: 0;
  background: transparent;
}

.theme-toggle-icon--dark {
  display: none;
}

html[data-gestfel-theme="dark"] .theme-toggle-icon--light {
  display: none;
}

html[data-gestfel-theme="dark"] .theme-toggle-icon--dark {
  display: inline-block;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--gf-accent);
  background: var(--gf-accent-soft);
  color: var(--gf-text);
}

.theme-toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--gf-accent) 92%, #000);
  border-color: color-mix(in srgb, var(--gf-accent) 88%, #000);
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gf-accent) 18%, transparent), var(--gf-shadow-soft);
}

.public-nav .theme-toggle {
  min-height: 40px;
}

.app-top .user-chip {
  gap: .55rem;
}

.app-top,
.desktop-top-nav-row,
.public-nav {
  background: color-mix(in srgb, var(--gf-panel) 92%, transparent);
  border-color: var(--gf-line);
  box-shadow: 0 10px 28px rgba(15, 36, 55, .055);
  backdrop-filter: blur(14px);
}

.desktop-top-nav a,
.desktop-top-more-summary,
.mobile-bottom-nav,
.mobile-bottom-item,
.app-context-breadcrumb,
.account-link,
.logout {
  border-color: var(--gf-line);
}

.desktop-top-nav a.active,
.desktop-top-nav a:hover,
.desktop-top-more[open] .desktop-top-more-summary,
.mobile-bottom-item.active,
.app-context-breadcrumb {
  background: var(--gf-accent-soft);
  color: var(--gf-accent);
}

.app-main > .card,
.card,
.page-head,
.module-pro-head,
.list-work-card,
.dashboard-fixed-panel,
.dashboard-widget,
.clinical-page .card,
.cat-profile-card,
.cat-clinical-section,
.public-card,
.login-card,
.support-card,
.settings-panel,
.archive-panel {
  border-color: var(--gf-line);
  border-radius: var(--gf-radius-panel);
  background: var(--gf-panel);
  box-shadow: var(--gf-shadow);
}

.page-head,
.module-pro-head,
.clinical-head,
.dashboard-pro-head,
.cat-profile-card {
  border-left: 5px solid var(--gf-accent);
  background:
    linear-gradient(120deg, var(--gf-accent-soft), transparent 40%),
    linear-gradient(180deg, var(--gf-panel), var(--gf-panel-soft));
}

.page-head h1,
.page-head h2,
.module-pro-title h1,
.module-pro-head h1,
.card h2,
.card h3,
.dashboard-widget-titlebar h2,
.cat-profile-info h2,
.cat-clinical-head h2,
.clinical-detail h2,
.clinical-patients h2 {
  color: var(--gf-text);
  letter-spacing: 0;
  text-wrap: balance;
}

.page-head p,
.module-pro-title p,
.card .muted,
.muted,
.field-help,
.dashboard-widget-titlebar p,
.cat-profile-location,
.cat-clinical-head p,
.clinical-timeline-item p,
.clinical-timeline-item small {
  color: var(--gf-muted);
}

.btn,
.button,
button,
input,
select,
textarea,
summary,
.colonies-list-action,
.clinical-timeline-edit,
.pro-pagination button,
.pager-size select {
  border-radius: var(--gf-radius-inner);
}

input,
select,
textarea,
.form input,
.form select,
.form textarea,
.list-search-form input {
  border-color: var(--gf-line);
  background: #fff;
  color: var(--gf-text);
}

input:focus,
select:focus,
textarea:focus,
.form input:focus,
.form select:focus,
.form textarea:focus {
  border-color: var(--gf-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--gf-accent) 14%, transparent);
  outline: none;
}

.btn-primary,
.button.primary,
button.primary,
.login-card button[type="submit"],
.public-page .btn-primary {
  background: var(--gf-accent);
  border-color: var(--gf-accent);
  color: #fff;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--gf-accent) 24%, transparent);
}

.btn-outline,
.button.outline,
.public-page .btn-outline,
.cat-profile-media .actions .btn,
.clinical-timeline-edit,
.colonies-list-action {
  background: var(--gf-panel);
  border-color: var(--gf-line-strong);
  color: var(--gf-accent);
}

.btn-outline:hover,
.button.outline:hover,
.public-page .btn-outline:hover,
.colonies-list-action:hover,
.clinical-timeline-edit:hover {
  background: var(--gf-accent-soft);
  border-color: var(--gf-accent);
  color: var(--gf-text);
}

.table-wrap,
.pro-table-wrap,
.clinical-table-wrap,
.responsive-table-wrap {
  border-color: var(--gf-line);
  border-radius: var(--gf-radius-panel);
  background: var(--gf-panel);
}

.table th,
.pro-table th,
.cats-pro-table thead th,
.clinical-table th,
.dashboard-dv8-grid .table th {
  background: var(--gf-panel-tint);
  color: color-mix(in srgb, var(--gf-text) 82%, var(--gf-accent));
  border-bottom: 1px solid var(--gf-line);
  font-size: .74rem;
  letter-spacing: 0;
}

.table td,
.pro-table td,
.cats-pro-table td,
.clinical-table td,
.dashboard-dv8-grid .table td {
  border-bottom-color: color-mix(in srgb, var(--gf-line) 74%, #fff);
}

.table tr:hover td,
.pro-table tbody tr:hover td,
.cats-pro-table tbody tr:hover,
.clinical-table tbody tr:hover td,
.dashboard-dv8-grid .table tr:hover td {
  background: var(--gf-panel-soft);
}

.badge,
.status-badge,
.health-pill,
.species-pill,
.clinical-status,
.urgency-badge {
  border-radius: 999px;
  border-color: color-mix(in srgb, currentColor 18%, transparent);
  font-weight: 850;
}

.dashboard-pro-head {
  border-color: var(--gf-line);
  border-left-color: var(--gf-accent);
}

.dashboard-command-kpis {
  border-color: var(--gf-line);
  background: var(--gf-panel);
  box-shadow: var(--gf-shadow);
}

.dashboard-command-kpis .kpi.card,
.dashboard-command-kpis .kpi.card:nth-child(1),
.dashboard-command-kpis .kpi.card:nth-child(2),
.dashboard-command-kpis .kpi.card:nth-child(5) {
  border-color: var(--gf-line);
  background: var(--gf-panel-soft);
  color: var(--gf-text);
}

.dashboard-command-kpis .kpi.card span,
.dashboard-command-kpis .kpi.card:nth-child(1) span,
.dashboard-command-kpis .kpi.card:nth-child(2) span,
.dashboard-command-kpis .kpi.card:nth-child(5) span {
  color: var(--gf-muted);
}

.dashboard-command-kpis .kpi-icon,
.dashboard-command-kpis svg.kpi-icon {
  color: var(--gf-accent);
}

.task-alert-panel.dashboard-fixed-panel,
.notice-board.dashboard-fixed-panel,
.dashboard-priority-panel.dashboard-fixed-panel,
.dashboard-dv8-grid .dashboard-widget {
  border-color: var(--gf-line);
  background: var(--gf-panel);
  box-shadow: var(--gf-shadow);
}

.task-alert-item {
  border-color: var(--gf-line);
  border-left-color: var(--gf-accent);
  background: var(--gf-panel);
}

.task-alert-item:hover {
  background: var(--gf-panel-soft);
  border-color: var(--gf-line-strong);
}

.dashboard-dv8-grid .dashboard-widget-titlebar,
.dashboard-widget[data-widget-id="monthly-evolution"] .dashboard-widget-titlebar {
  border-bottom-color: var(--gf-line);
  background:
    linear-gradient(90deg, var(--gf-accent-soft), transparent 58%),
    var(--gf-panel-soft);
}

.dashboard-widget[data-widget-id="monthly-evolution"] {
  background: var(--gf-panel);
  color: var(--gf-text);
}

.dashboard-widget[data-widget-id="monthly-evolution"] h2,
.dashboard-widget[data-widget-id="monthly-evolution"] p {
  color: var(--gf-text);
}

.dashboard-widget[data-widget-id="monthly-evolution"] .muted,
.dashboard-widget[data-widget-id="monthly-evolution"] .dashboard-widget-titlebar p {
  color: var(--gf-muted);
}

/* Generico: el resto de graficos (p.ej. reports.php) usan la misma clase
   .chart-canvas pero no estaban cubiertos por el selector especifico de
   "monthly-evolution" de arriba. El texto/lineas del canvas los pinta JS
   con Canvas 2D (ver chartAxisColor/chartGridColor/chartValueColor en
   app.js), que ya leen estas mismas variables. */
.chart-canvas {
  background: var(--gf-panel);
  border-color: var(--gf-line);
}

.dashboard-widget[data-widget-id="monthly-evolution"] .chart-canvas {
  background: var(--gf-panel);
  border: 1px solid var(--gf-line);
  border-radius: var(--gf-radius-inner);
}

.dashboard-widget[data-widget-id="health-reminders"] {
  border-top-color: var(--gf-danger);
}

.dashboard-widget[data-widget-id="costs"] {
  border-top-color: var(--gf-accent);
}

.dashboard-widget[data-widget-id="recent-alerts"],
.dashboard-widget[data-widget-id="tasks"],
.dashboard-widget[data-widget-id="quick-actions"] {
  background: var(--gf-panel);
}

.cats-workspace .cat-selection-card,
.clinical-patients,
.clinical-detail,
.clinical-costs,
.cat-clinical-section,
.cat-profile-card {
  border-color: var(--gf-line);
  background: var(--gf-panel);
  box-shadow: var(--gf-shadow);
}

.cats-workspace .cat-selection-photo {
  background: var(--gf-panel-tint);
}

.cats-workspace .cat-info-grid span,
.cats-workspace .cat-selection-notes article,
.cat-profile-facts p,
.clinical-summary-kpi,
.cat-clinical-aside > section,
.clinical-timeline,
.clinical-timeline-item,
.clinical-doc-thumb {
  border-color: var(--gf-line);
  background: var(--gf-panel-soft);
}

.clinical-timeline-list::before {
  background: linear-gradient(180deg, var(--gf-accent), var(--gf-line));
}

.clinical-timeline-item:hover,
.cat-profile-facts p:hover {
  background: var(--gf-panel);
  border-color: var(--gf-line-strong);
}

.clinical-kpi,
.incident-summary-kpi,
.compact-kpis .kpi,
.report-kpi,
.council-main-kpis .kpi,
.foster-home-kpi {
  border-color: var(--gf-line);
  background: var(--gf-panel-soft);
  box-shadow: var(--gf-shadow-soft);
}

.actions,
.page-actions,
.clinical-actions,
.cat-profile-media .actions {
  gap: .5rem;
}

.site-footer.brand-footer {
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--brand-primary) 88%, #0f2437), color-mix(in srgb, var(--brand-primary) 40%, var(--brand-dark)));
  color: #fff;
}

.site-footer.brand-footer .brand,
.site-footer.brand-footer .footer-brand,
.site-footer.brand-footer strong,
.site-footer.brand-footer h4,
.site-footer.brand-footer p,
.site-footer.brand-footer a {
  color: #fff;
}

.site-footer.brand-footer a:hover,
.site-footer.brand-footer a:focus-visible {
  color: color-mix(in srgb, #fff 84%, var(--brand-primary-pale));
}

.app-icon-type-cat,
.app-icon-cat,
.app-icon-gato,
.app-icon-gatos {
  color: #5660a8;
  background: #f2f4ff;
}

/* Icon system polish: consistent optical boxes and baseline alignment. */
.app-icon,
.nav-icon,
.top-nav-icon,
.mobile-bottom-icon,
.kpi-icon,
.theme-toggle-icon {
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: -.18em;
  shape-rendering: geometricPrecision;
}

.desktop-top-nav a,
.desktop-top-more-summary,
.sidebar nav a,
.mobile-bottom-item,
.btn,
.button,
button,
.account-link,
.logout,
.colonies-list-action,
.clinical-timeline-edit,
.cat-profile-media .actions a,
.cat-profile-media .actions button {
  align-items: center;
}

.desktop-top-nav a,
.desktop-top-more-summary {
  gap: .42rem;
}

.top-nav-icon,
.desktop-top-more-summary .top-nav-icon {
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 7px;
  background: var(--gf-accent-soft);
  color: var(--gf-accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 16%, transparent);
}

.desktop-top-nav a.active .top-nav-icon,
.desktop-top-nav a:hover .top-nav-icon,
.desktop-top-more[open] .top-nav-icon {
  background: var(--gf-panel);
  color: var(--gf-accent);
}

.sidebar nav a .nav-icon {
  width: 30px;
  height: 30px;
  padding: 6px;
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 13%, transparent);
}

.mobile-bottom-item {
  gap: .2rem;
}

.mobile-bottom-icon {
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 8px;
  background: var(--gf-panel-soft);
  color: var(--gf-accent);
}

.mobile-bottom-item.active .mobile-bottom-icon {
  background: var(--gf-accent-soft);
  box-shadow: inset 0 0 0 1px var(--gf-line);
}

.dashboard-command-kpis .kpi.card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  align-content: center;
  column-gap: .8rem;
  row-gap: .26rem;
}

.dashboard-command-kpis .kpi-icon,
.dashboard-command-kpis svg.kpi-icon {
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: center;
  width: 58px;
  height: 58px;
  padding: 10px;
  border-radius: 16px;
  background: var(--gf-accent-soft);
  box-shadow: inset 0 0 0 1px var(--gf-line);
}

.dashboard-command-kpis .app-illustrated-icon.kpi-icon,
.dashboard-command-kpis .app-generated-icon.kpi-icon {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 14px !important;
  clip-path: inset(0 round 14px);
}

.dashboard-command-kpis .app-generated-icon.kpi-icon {
  width: 76px;
  height: 76px;
  border-radius: 18px !important;
  clip-path: none;
  overflow: visible !important;
  transform: scale(2.08);
  transform-origin: center;
}

.dashboard-command-kpis .app-icon-type-inventory.kpi-icon {
  transform: scale(1.52);
  transform-origin: center;
}

.cat-info-grid svg,
.cat-info-grid .app-icon,
.cats-workspace .cat-selection-notes article > span,
.clinical-summary-kpi > .app-icon,
.clinical-summary-kpi > svg,
.clinical-meta .app-icon,
.clinical-date .app-icon,
.card-icon .app-icon,
.module-pro-icon .app-icon {
  width: 28px;
  height: 28px;
  padding: 6px;
  border-radius: 9px;
  background: var(--gf-accent-soft);
  color: var(--gf-accent);
  box-shadow: inset 0 0 0 1px var(--gf-line);
}

.btn .app-icon,
.button .app-icon,
button .app-icon,
.list-search-form button .app-icon,
.list-filter-details > summary .app-icon,
.reports-export-btn .app-icon {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.badge,
.status-badge,
.health-pill,
.species-pill,
.clinical-status,
.urgency-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: .24rem .52rem;
  line-height: 1;
}

html[data-gestfel-theme="dark"] body.app-body,
html[data-gestfel-theme="dark"] body.public-page,
html[data-gestfel-theme="dark"] .login-page {
  background:
    radial-gradient(circle at 18% 4%, rgba(111, 214, 199, .08), transparent 30%),
    linear-gradient(180deg, #0d191d 0%, var(--gf-page-bg) 50%, #0a1518 100%);
}

/* .login-card p usa un color fijo (--dark) pensado para tarjeta blanca;
   sobre el fondo oscuro de .login-card (var(--gf-panel)) resultaba casi invisible.
   El h1 se corrige en 90-gestfel-demo-overrides.css: su color vive en @layer
   overrides, que siempre gana a @layer theme aunque la especificidad coincida. */
html[data-gestfel-theme="dark"] .login-card p {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] body.app-body,
html[data-gestfel-theme="dark"] .app-shell,
html[data-gestfel-theme="dark"] .app-main {
  background-color: #0d191d;
}

html[data-gestfel-theme="dark"] .app-shell,
html[data-gestfel-theme="dark"] .app-main {
  background-image: none;
}

html[data-gestfel-theme="dark"] .colony-detail-hero,
html[data-gestfel-theme="dark"] .colony-detail-kpi,
html[data-gestfel-theme="dark"] .colony-photo-strip,
html[data-gestfel-theme="dark"] .colony-feeding-panel,
html[data-gestfel-theme="dark"] .colony-feeding-grid .feeding-kpi-card,
html[data-gestfel-theme="dark"] .colony-census-card .grid.four > div {
  background: linear-gradient(135deg, #13282e, #102229);
  border-color: var(--gf-line-strong);
  box-shadow: var(--gf-shadow-soft);
}

html[data-gestfel-theme="dark"] .colony-detail-notes,
html[data-gestfel-theme="dark"] .colony-photo-chip {
  background: color-mix(in srgb, var(--gf-panel-soft) 86%, #0d1f24);
  border-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .colony-detail-heading h1,
html[data-gestfel-theme="dark"] .colony-detail-notes strong,
html[data-gestfel-theme="dark"] .colony-photo-strip h2,
html[data-gestfel-theme="dark"] .colony-photo-chip strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .colony-detail-heading .eyebrow,
html[data-gestfel-theme="dark"] .colony-detail-meta,
html[data-gestfel-theme="dark"] .colony-detail-notes p,
html[data-gestfel-theme="dark"] .colony-detail-kpi small,
html[data-gestfel-theme="dark"] .colony-photo-strip p,
html[data-gestfel-theme="dark"] .colony-photo-chip small,
html[data-gestfel-theme="dark"] .colony-feeding-grid span {
  color: var(--gf-muted);
}

/* Módulo colonias (mapa y listado): tarjetas y paneles seguían con fondos claros fijos */
html[data-gestfel-theme="dark"] .colony-side-stat,
html[data-gestfel-theme="dark"] .colony-side-stat--cats,
html[data-gestfel-theme="dark"] .colony-side-stat--ster,
html[data-gestfel-theme="dark"] .colony-side-stat--alert,
html[data-gestfel-theme="dark"] .colonies-side-list,
html[data-gestfel-theme="dark"] .colony-list-card,
html[data-gestfel-theme="dark"] .colonies-list-footer,
html[data-gestfel-theme="dark"] .colonies-list-detail,
html[data-gestfel-theme="dark"] .colonies-map-shell {
  background: linear-gradient(135deg, #13282e, #102229);
  border-color: var(--gf-line-strong);
}

html[data-gestfel-theme="dark"] .side-stat-icon,
html[data-gestfel-theme="dark"] .colony-floating-card {
  background: color-mix(in srgb, var(--gf-panel) 85%, transparent);
  border-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .colonies-list-detail__photo,
html[data-gestfel-theme="dark"] .floating-colony-photo,
html[data-gestfel-theme="dark"] .colony-thumb {
  background: var(--gf-panel-soft);
}

html[data-gestfel-theme="dark"] .colonies-list-detail__metrics span,
html[data-gestfel-theme="dark"] .floating-metrics span,
html[data-gestfel-theme="dark"] .floating-card-row > span {
  background: var(--gf-panel-soft);
  border-color: var(--gf-line);
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .colony-side-stat strong,
html[data-gestfel-theme="dark"] .colony-side-stat b,
html[data-gestfel-theme="dark"] .side-list-head h2,
html[data-gestfel-theme="dark"] .colony-list-card__body strong,
html[data-gestfel-theme="dark"] .colonies-list-detail__title h3,
html[data-gestfel-theme="dark"] .colony-floating-close,
html[data-gestfel-theme="dark"] .floating-card-row strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .colony-side-stat small,
html[data-gestfel-theme="dark"] .side-list-head p,
html[data-gestfel-theme="dark"] .colony-list-card__body small,
html[data-gestfel-theme="dark"] .colonies-list-detail__meta,
html[data-gestfel-theme="dark"] .floating-card-row small {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .page-head,
html[data-gestfel-theme="dark"] .module-pro-head,
html[data-gestfel-theme="dark"] .dashboard-pro-head,
html[data-gestfel-theme="dark"] .cat-profile-card {
  border-left-width: 7px;
  background:
    linear-gradient(120deg, rgba(111, 214, 199, .12), transparent 42%),
    linear-gradient(180deg, #172b31, #13262c);
  border-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .page-head h1,
html[data-gestfel-theme="dark"] .page-head h2,
html[data-gestfel-theme="dark"] .module-pro-title h1,
html[data-gestfel-theme="dark"] .dashboard-pro-head h1,
html[data-gestfel-theme="dark"] .card h2,
html[data-gestfel-theme="dark"] .card h3,
html[data-gestfel-theme="dark"] .dashboard-widget-titlebar h2,
html[data-gestfel-theme="dark"] .task-alert-item strong,
html[data-gestfel-theme="dark"] .dashboard-priority-head h2,
html[data-gestfel-theme="dark"] .dashboard-priority-main strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .page-head p,
html[data-gestfel-theme="dark"] .module-pro-title p,
html[data-gestfel-theme="dark"] .dashboard-pro-head p,
html[data-gestfel-theme="dark"] .task-alert-detail,
html[data-gestfel-theme="dark"] .task-alert-item span,
html[data-gestfel-theme="dark"] .task-alert-item small,
html[data-gestfel-theme="dark"] .dashboard-priority-main em,
html[data-gestfel-theme="dark"] .dashboard-priority-meta {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .app-top,
html[data-gestfel-theme="dark"] .desktop-top-nav-row,
html[data-gestfel-theme="dark"] .public-nav,
html[data-gestfel-theme="dark"] .mobile-bottom-nav {
  background: rgba(21, 39, 45, .9);
  border-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .brand,
html[data-gestfel-theme="dark"] .desktop-top-nav a,
html[data-gestfel-theme="dark"] .desktop-top-more-summary,
html[data-gestfel-theme="dark"] .mobile-bottom-item,
html[data-gestfel-theme="dark"] .account-link,
html[data-gestfel-theme="dark"] .logout,
html[data-gestfel-theme="dark"] .nav-links a {
  color: var(--gf-text);
}

/* .user-chip .logout fija color/background en 20-forms-auth.css (capa forms);
   la capa theme gana en color pero no en background si no se declara aquí,
   dejando texto claro sobre el fondo rosa claro original. */
html[data-gestfel-theme="dark"] .user-chip .logout {
  color: #ffb4a9;
  background: rgba(239, 111, 97, .16);
}

html[data-gestfel-theme="dark"] .desktop-top-more-menu {
  background: rgba(21, 39, 45, .98);
  border-color: var(--gf-line-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .34);
}

html[data-gestfel-theme="dark"] .desktop-top-more-menu a {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .desktop-top-more-menu a:hover,
html[data-gestfel-theme="dark"] .desktop-top-more-menu a:focus-visible {
  background: rgba(111, 214, 199, .1);
  color: #dffff9;
}

html[data-gestfel-theme="dark"] input,
html[data-gestfel-theme="dark"] select,
html[data-gestfel-theme="dark"] textarea,
html[data-gestfel-theme="dark"] .form input,
html[data-gestfel-theme="dark"] .form select,
html[data-gestfel-theme="dark"] .form textarea,
html[data-gestfel-theme="dark"] .list-search-form input {
  background: #102026;
  color: var(--gf-text);
  border-color: var(--gf-line-strong);
}

html[data-gestfel-theme="dark"] .entity-form .field-group,
html[data-gestfel-theme="dark"] .entity-form .readonly-code {
  background:
    linear-gradient(135deg, rgba(19, 40, 46, .97), rgba(16, 34, 41, .98)),
    var(--gf-panel);
  border-color: var(--gf-line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03), var(--gf-shadow-soft);
}

html[data-gestfel-theme="dark"] .entity-form .field-group legend {
  color: var(--gf-accent);
  background: #0d191d;
}

html[data-gestfel-theme="dark"] .entity-form .field-group label {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] input::placeholder,
html[data-gestfel-theme="dark"] textarea::placeholder {
  color: #7f9893;
}

html[data-gestfel-theme="dark"] .btn-outline,
html[data-gestfel-theme="dark"] .button.outline,
html[data-gestfel-theme="dark"] .public-page .btn-outline,
html[data-gestfel-theme="dark"] .cat-profile-media .actions .btn,
html[data-gestfel-theme="dark"] .clinical-timeline-edit,
html[data-gestfel-theme="dark"] .colonies-list-action {
  background: #102026;
  color: var(--gf-accent);
  border-color: var(--gf-line-strong);
}

html[data-gestfel-theme="dark"] .task-alert-item,
html[data-gestfel-theme="dark"] .dashboard-priority-item,
html[data-gestfel-theme="dark"] .notice-item,
html[data-gestfel-theme="dark"] .timeline-item.unread,
html[data-gestfel-theme="dark"] .dashboard-widget[data-widget-id="recent-alerts"] > p,
html[data-gestfel-theme="dark"] .dashboard-widget[data-widget-id="tasks"] > p {
  background: #12242a;
  border-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .dashboard-priority-head {
  border-bottom-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .dashboard-priority-head > a,
html[data-gestfel-theme="dark"] .dashboard-priority-head-actions > a,
html[data-gestfel-theme="dark"] .dashboard-priority-item > a,
html[data-gestfel-theme="dark"] .dashboard-priority-actions a,
html[data-gestfel-theme="dark"] .dashboard-priority-toggle {
  background: #102026;
  color: var(--gf-text);
  border-color: var(--gf-line-strong);
  box-shadow: none;
}

html[data-gestfel-theme="dark"] .dashboard-priority-chip {
  background: #102026;
  border-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .dashboard-priority-chip b {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .dashboard-priority-chip--expired {
  background: rgba(127, 29, 29, .28);
  border-color: rgba(251, 113, 133, .34);
  color: #fecdd3;
}

html[data-gestfel-theme="dark"] .dashboard-priority-chip--soon {
  background: rgba(120, 53, 15, .3);
  border-color: rgba(251, 191, 36, .32);
  color: #fde68a;
}

html[data-gestfel-theme="dark"] .dashboard-priority-chip--open {
  background: rgba(20, 83, 76, .34);
  border-color: rgba(94, 234, 212, .26);
  color: #99f6e4;
}

html[data-gestfel-theme="dark"] .dashboard-priority-item--expired {
  background: linear-gradient(90deg, rgba(127, 29, 29, .34), #12242a 44%);
  border-left-color: #fb7185;
}

html[data-gestfel-theme="dark"] .dashboard-priority-item--soon {
  background: linear-gradient(90deg, rgba(120, 53, 15, .34), #12242a 44%);
  border-left-color: #fbbf24;
}

html[data-gestfel-theme="dark"] .dashboard-priority-item--open {
  background: linear-gradient(90deg, rgba(20, 83, 76, .34), #12242a 44%);
  border-left-color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .dashboard-priority-item--expired .dashboard-priority-state {
  color: #fecdd3;
  background: rgba(127, 29, 29, .36);
}

html[data-gestfel-theme="dark"] .dashboard-priority-item--soon .dashboard-priority-state {
  color: #fde68a;
  background: rgba(120, 53, 15, .38);
}

html[data-gestfel-theme="dark"] .dashboard-priority-item--open .dashboard-priority-state {
  color: #99f6e4;
  background: rgba(20, 83, 76, .4);
}

html[data-gestfel-theme="dark"] .dashboard-dv8-grid .dashboard-widget-titlebar,
html[data-gestfel-theme="dark"] .dashboard-widget[data-widget-id="monthly-evolution"] .dashboard-widget-titlebar {
  background:
    linear-gradient(90deg, rgba(111, 214, 199, .13), transparent 58%),
    #172b31;
}

html[data-gestfel-theme="dark"] .table th,
html[data-gestfel-theme="dark"] .pro-table th,
html[data-gestfel-theme="dark"] .cats-pro-table thead th,
html[data-gestfel-theme="dark"] .clinical-table th,
html[data-gestfel-theme="dark"] .dashboard-dv8-grid .table th {
  background: color-mix(in srgb, var(--gf-accent) 14%, #14262b);
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .card,
html[data-gestfel-theme="dark"] .dashboard-widget,
html[data-gestfel-theme="dark"] .page-head,
html[data-gestfel-theme="dark"] .module-pro-head,
html[data-gestfel-theme="dark"] .cat-selection-card,
html[data-gestfel-theme="dark"] .cat-profile-card,
html[data-gestfel-theme="dark"] .cat-clinical-section {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gf-accent) 14%, transparent), var(--gf-shadow);
}

html[data-gestfel-theme="dark"] .table td,
html[data-gestfel-theme="dark"] .pro-table td,
html[data-gestfel-theme="dark"] .cats-pro-table td,
html[data-gestfel-theme="dark"] .clinical-table td,
html[data-gestfel-theme="dark"] .dashboard-dv8-grid .table td {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .clinical-table tbody tr,
html[data-gestfel-theme="dark"] .clinical-table tbody tr:nth-child(even),
html[data-gestfel-theme="dark"] .clinical-table td {
  background: color-mix(in srgb, var(--gf-panel-soft) 88%, #0d1f24);
}

html[data-gestfel-theme="dark"] .clinical-table tbody tr:hover td,
html[data-gestfel-theme="dark"] .clinical-table tbody tr.is-selected td {
  background: color-mix(in srgb, var(--gf-accent) 16%, var(--gf-panel-soft));
}

html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table,
html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table tbody,
html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table tr,
html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table td,
html[data-gestfel-theme="dark"] .cats-workspace .pro-table-wrap {
  background: var(--gf-panel);
  color: var(--gf-text);
  border-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table tbody tr:nth-child(even),
html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table tbody tr:hover,
html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table tr.is-selected {
  background: color-mix(in srgb, var(--gf-accent) 10%, var(--gf-panel-soft));
}

html[data-gestfel-theme="dark"] .pro-table tbody tr.is-selected,
html[data-gestfel-theme="dark"] .pro-table tbody tr.is-selected td,
html[data-gestfel-theme="dark"] .requests-table tr.is-selected,
html[data-gestfel-theme="dark"] .requests-table tr.is-selected td,
html[data-gestfel-theme="dark"] .requests-table tr[data-request-row].is-selected,
html[data-gestfel-theme="dark"] .requests-table tr[data-request-row].is-selected td {
  background: color-mix(in srgb, var(--gf-accent) 14%, var(--gf-panel-soft));
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table td::before,
html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table small,
html[data-gestfel-theme="dark"] .cats-workspace .cats-pro-table .muted {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .cats-workspace .list-work-card,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-card,
html[data-gestfel-theme="dark"] .cats-workspace .health-summary,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-notes article,
html[data-gestfel-theme="dark"] .cats-workspace .cat-info-grid span,
html[data-gestfel-theme="dark"] .cats-workspace .cat-detail-next-review {
  border-color: var(--gf-line);
  background: linear-gradient(135deg, #13282e, #102229);
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .cats-workspace .list-work-toolbar h2,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-title h2,
html[data-gestfel-theme="dark"] .cats-workspace .cat-info-grid b,
html[data-gestfel-theme="dark"] .cats-workspace .cat-info-grid strong,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-notes strong,
html[data-gestfel-theme="dark"] .cats-workspace .health-summary strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .cats-workspace .list-work-toolbar p,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-main > p,
html[data-gestfel-theme="dark"] .cats-workspace .cat-info-grid span,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-notes p,
html[data-gestfel-theme="dark"] .cats-workspace .health-summary small {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-aside .colonies-list-action,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-actions a,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-actions button {
  background: #102026;
  border-color: var(--gf-line-strong);
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-aside .colonies-list-action:hover,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-actions a:hover,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-actions button:hover {
  background: rgba(111, 214, 199, .12);
  color: #dffff9;
}

html[data-gestfel-theme="dark"] .clinical-table a,
html[data-gestfel-theme="dark"] .clinical-table strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .clinical-table small,
html[data-gestfel-theme="dark"] .clinical-table .muted,
html[data-gestfel-theme="dark"] .clinical-doc-event {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .clinical-kpi strong,
html[data-gestfel-theme="dark"] .clinical-kpi small {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .clinical-kpi small {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .sidebar,
html[data-gestfel-theme="dark"] .app-shell > .sidebar {
  background: linear-gradient(180deg, #13262c, #102026);
  border-color: var(--gf-line);
  box-shadow: 18px 0 50px rgba(0, 0, 0, .28);
}

html[data-gestfel-theme="dark"] .sidebar nav a {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .sidebar nav a.active,
html[data-gestfel-theme="dark"] .sidebar nav a:hover,
html[data-gestfel-theme="dark"] .sidebar nav a:focus-visible {
  background: rgba(111, 214, 199, .12);
  color: #dffff9;
}

html[data-gestfel-theme="dark"] .clinical-profile h2,
html[data-gestfel-theme="dark"] .clinical-timeline h3,
html[data-gestfel-theme="dark"] .clinical-docs h3,
html[data-gestfel-theme="dark"] .cat-clinical-aside h3,
html[data-gestfel-theme="dark"] .clinical-timeline-item strong,
html[data-gestfel-theme="dark"] .clinical-patient strong,
html[data-gestfel-theme="dark"] .clinical-case strong,
html[data-gestfel-theme="dark"] .clinical-summary-kpi > strong,
html[data-gestfel-theme="dark"] .cat-profile-info h2,
html[data-gestfel-theme="dark"] .cat-profile-facts p {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .clinical-meta,
html[data-gestfel-theme="dark"] .clinical-meta span,
html[data-gestfel-theme="dark"] .clinical-timeline-item time,
html[data-gestfel-theme="dark"] .clinical-timeline-item p,
html[data-gestfel-theme="dark"] .clinical-timeline-item small,
html[data-gestfel-theme="dark"] .clinical-patient small,
html[data-gestfel-theme="dark"] .clinical-case small,
html[data-gestfel-theme="dark"] .clinical-case em,
html[data-gestfel-theme="dark"] .clinical-summary-kpi,
html[data-gestfel-theme="dark"] .clinical-summary-kpi > small,
html[data-gestfel-theme="dark"] .cat-clinical-notes p,
html[data-gestfel-theme="dark"] .cat-profile-location,
html[data-gestfel-theme="dark"] .cat-profile-facts strong {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .clinical-kpi,
html[data-gestfel-theme="dark"] .clinical-kpi--green,
html[data-gestfel-theme="dark"] .clinical-kpi--orange,
html[data-gestfel-theme="dark"] .clinical-kpi--blue,
html[data-gestfel-theme="dark"] .clinical-kpi--red,
html[data-gestfel-theme="dark"] .clinical-summary-kpi,
html[data-gestfel-theme="dark"] .clinical-timeline,
html[data-gestfel-theme="dark"] .clinical-timeline-item,
html[data-gestfel-theme="dark"] .clinical-doc-thumb,
html[data-gestfel-theme="dark"] .cat-clinical-aside > section,
html[data-gestfel-theme="dark"] .cat-profile-facts p,
html[data-gestfel-theme="dark"] .cat-clinical-notes .soft-card,
html[data-gestfel-theme="dark"] .general-notes,
html[data-gestfel-theme="dark"] .vet-attachments {
  border-color: var(--gf-line);
  background: linear-gradient(135deg, #13282e, #102229);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}

html[data-gestfel-theme="dark"] .clinical-timeline-item:hover,
html[data-gestfel-theme="dark"] .clinical-doc-thumb:hover {
  background: linear-gradient(135deg, #183139, #12262c);
  border-color: var(--gf-line-strong);
}

html[data-gestfel-theme="dark"] .entity-form .field-group .vet-attachment-delete,
html[data-gestfel-theme="dark"] .vet-attachment-delete {
  border-color: rgba(239, 111, 97, .38);
  background: #2b1714;
  color: #ffb4a9;
}

html[data-gestfel-theme="dark"] .vet-attachment-delete input {
  accent-color: #ffb4a9;
}

/* Modulo de informes: varios componentes propios (fuera del sistema
   generico .card/.dashboard-fixed-panel) fijan fondos y textos en claro
   sin variante oscura. */
html[data-gestfel-theme="dark"] .reports-pro-title .eyebrow,
html[data-gestfel-theme="dark"] .reports-pro-title p {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .reports-pro-title h1 {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .reports-pro-icon {
  border-color: var(--gf-line);
  background: var(--gf-accent-soft);
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .reports-dashboard-grid--executive .report-widget {
  background: var(--gf-panel);
}

html[data-gestfel-theme="dark"] .reports-executive-table th {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .reports-executive-table td {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .reports-executive-table a {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .reports-executive-table a:hover,
html[data-gestfel-theme="dark"] .reports-executive-table a:focus-visible {
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .reports-shortcut-card {
  border-color: var(--gf-line);
  background: var(--gf-panel);
}

html[data-gestfel-theme="dark"] .reports-shortcut-card:hover,
html[data-gestfel-theme="dark"] .reports-shortcut-card:focus-visible {
  border-color: var(--gf-line-strong);
}

html[data-gestfel-theme="dark"] .reports-shortcut-card > span {
  background: var(--gf-accent-soft);
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .reports-shortcut-card strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .reports-shortcut-card small {
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .reports-shortcut-card em {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .reports-vet-year-row {
  border-top-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .reports-vet-year-row select {
  border-color: var(--gf-line);
  background: var(--gf-panel-soft);
  color: var(--gf-text);
}

/* Panel Ayuntamiento (council.php): usa sus propios tonos de marca
   (--brand-primary-rgb/--brand-soft-rgb) y colores fijos (--dark/--muted),
   ninguno con variante oscura. */
html[data-gestfel-theme="dark"] .council-hero {
  border-color: var(--gf-line);
  background: linear-gradient(135deg, var(--gf-panel), var(--gf-panel-soft));
  box-shadow: var(--gf-shadow);
}

html[data-gestfel-theme="dark"] .council-eyebrow,
html[data-gestfel-theme="dark"] .council-hero p,
html[data-gestfel-theme="dark"] .council-card-head span,
html[data-gestfel-theme="dark"] .council-alert-list small,
html[data-gestfel-theme="dark"] .council-pending-list small,
html[data-gestfel-theme="dark"] .council-kpi-strip span,
html[data-gestfel-theme="dark"] .council-widget-titlebar p,
html[data-gestfel-theme="dark"] .council-card-head .dashboard-widget-heading p {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .council-hero h1,
html[data-gestfel-theme="dark"] .council-date,
html[data-gestfel-theme="dark"] .council-kpi-main span:not(.council-kpi-icon),
html[data-gestfel-theme="dark"] .council-kpi-main strong,
html[data-gestfel-theme="dark"] .council-widget-titlebar h2,
html[data-gestfel-theme="dark"] .council-card-head .dashboard-widget-heading h2 {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .council-widget-titlebar,
html[data-gestfel-theme="dark"] .council-card-head.dashboard-widget-titlebar {
  border-bottom-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .council-kpi-main {
  border-color: var(--gf-line);
  background: var(--gf-panel);
  box-shadow: var(--gf-shadow-soft);
}

html[data-gestfel-theme="dark"] .council-kpi-icon {
  background: var(--gf-accent-soft);
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .council-kpi-strip article {
  border-color: var(--gf-line);
  background: var(--gf-panel);
}

html[data-gestfel-theme="dark"] .council-kpi-strip strong {
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .council-card,
html[data-gestfel-theme="dark"] .council-reading {
  border-color: var(--gf-line);
  background: var(--gf-panel);
  box-shadow: var(--gf-shadow-soft);
}

html[data-gestfel-theme="dark"] .council-alert-list a,
html[data-gestfel-theme="dark"] .council-pending-list a {
  background: var(--gf-panel-soft);
}

html[data-gestfel-theme="dark"] .council-alert-list a:hover,
html[data-gestfel-theme="dark"] .council-pending-list a:hover {
  background: var(--gf-accent-soft);
}

html[data-gestfel-theme="dark"] .council-alert-icon,
html[data-gestfel-theme="dark"] .council-pending-list a > span {
  background: var(--gf-accent-soft);
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .council-card-link {
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .council-secure-note {
  border-color: var(--gf-line);
  background: var(--gf-accent-soft);
  color: var(--gf-accent);
}

/* Miniatura decorativa de mapa: mismo patron de calles/pines pero con base
   oscura y "calles" en un tono teal tenue en vez de blanco solido. */
html[data-gestfel-theme="dark"] .council-map-preview {
  border-color: var(--gf-line);
  background:
    linear-gradient(30deg, rgba(111,214,199,.14) 12%, transparent 12% 18%, rgba(244,162,97,.16) 18% 22%, transparent 22%),
    linear-gradient(150deg, transparent 18%, rgba(111,214,199,.12) 18% 24%, transparent 24% 58%, rgba(34,182,166,.16) 58% 64%, transparent 64%),
    var(--gf-panel-soft);
}

html[data-gestfel-theme="dark"] .council-map-preview::before,
html[data-gestfel-theme="dark"] .council-map-preview::after {
  background: rgba(111, 214, 199, .3);
}

html[data-gestfel-theme="dark"] .council-map-preview::before {
  box-shadow: 0 42px 0 rgba(111, 214, 199, .24), 0 -46px 0 rgba(111, 214, 199, .18);
}

html[data-gestfel-theme="dark"] .council-map-preview::after {
  box-shadow: 42px 0 0 rgba(111, 214, 199, .24), -46px 0 0 rgba(111, 214, 199, .18);
}

html[data-gestfel-theme="dark"] .council-map-preview span {
  border-color: var(--gf-panel);
}

/* KPIs superiores de informes (.reports-pro-kpi): mismo patron, fondo y
   texto fijos en claro sin variante oscura -- distinto de .reports-shortcut-card
   (ya corregido antes), se me paso en la primera pasada de este modulo. */
html[data-gestfel-theme="dark"] .reports-pro-kpi {
  border-color: var(--gf-line);
  background: var(--gf-panel);
  box-shadow: var(--gf-shadow-soft);
}

html[data-gestfel-theme="dark"] .reports-pro-kpi small {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .reports-pro-kpi strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .reports-pro-kpi em {
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .reports-pro-kpi > span {
  background: var(--gf-accent-soft);
  color: var(--gf-accent);
}

html[data-gestfel-theme="dark"] .reports-pro-kpi--amber > span {
  background: rgba(217, 119, 6, .16);
  color: #f0ad4e;
}

html[data-gestfel-theme="dark"] .reports-pro-kpi--green > span {
  background: rgba(21, 128, 61, .18);
  color: #4ade80;
}

html[data-gestfel-theme="dark"] .reports-pro-kpi--blue > span {
  background: rgba(37, 99, 235, .18);
  color: #7fb0ff;
}

html[data-gestfel-theme="dark"] .clinical-timeline-item > span:first-child,
html[data-gestfel-theme="dark"] .clinical-timeline-item.is-done > span:first-child,
html[data-gestfel-theme="dark"] .clinical-event-icon {
  background: #102026;
  box-shadow:
    0 0 0 4px #102026,
    0 0 0 8px rgba(111, 214, 199, .22),
    0 12px 24px rgba(0, 0, 0, .22);
}

html[data-gestfel-theme="dark"] .clinical-hero {
  background: linear-gradient(135deg, #173139, #102026);
}

html[data-gestfel-theme="dark"] .clinical-hero-fallback {
  background: color-mix(in srgb, var(--gf-accent) 10%, #102026);
}

html[data-gestfel-theme="dark"] .clinical-doc-thumb--file,
html[data-gestfel-theme="dark"] .clinical-doc-thumb--empty {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .clinical-status--ok,
html[data-gestfel-theme="dark"] .clinical-status--active {
  background: rgba(20, 83, 76, .38);
  color: #99f6e4;
}

html[data-gestfel-theme="dark"] .clinical-status--notice {
  background: rgba(30, 64, 175, .32);
  color: #bfdbfe;
}

html[data-gestfel-theme="dark"] .clinical-status--warning {
  background: rgba(120, 53, 15, .34);
  color: #fde68a;
}

html[data-gestfel-theme="dark"] .clinical-status--muted {
  background: rgba(100, 116, 139, .2);
  color: #cbd5e1;
}

html[data-gestfel-theme="dark"] .incident-detail-shell,
html[data-gestfel-theme="dark"] .request-detail-shell,
html[data-gestfel-theme="dark"] .incident-detail-head,
html[data-gestfel-theme="dark"] .incident-status-card,
html[data-gestfel-theme="dark"] .incident-media-card,
html[data-gestfel-theme="dark"] .request-media-card,
html[data-gestfel-theme="dark"] .incident-facts-card,
html[data-gestfel-theme="dark"] .incident-summary-card,
html[data-gestfel-theme="dark"] .incident-history-card,
html[data-gestfel-theme="dark"] .incident-manage-card,
html[data-gestfel-theme="dark"] .incident-summary-kpis article,
html[data-gestfel-theme="dark"] .incident-admin-note,
html[data-gestfel-theme="dark"] .incident-workflow-help,
html[data-gestfel-theme="dark"] .request-detail-shell .incident-facts-card,
html[data-gestfel-theme="dark"] .request-detail-shell .incident-admin-note,
html[data-gestfel-theme="dark"] .status-report-detail-shell .incident-facts-card {
  border-color: var(--gf-line);
  background: linear-gradient(135deg, #13282e, #102229);
  color: var(--gf-text);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}

html[data-gestfel-theme="dark"] .incident-facts-card dl > div,
html[data-gestfel-theme="dark"] .request-detail-shell .incident-facts-card dl > div,
html[data-gestfel-theme="dark"] .status-report-detail-shell .incident-facts-card dl > div,
html[data-gestfel-theme="dark"] .incident-history-item > span,
html[data-gestfel-theme="dark"] .incident-summary-kpis span,
html[data-gestfel-theme="dark"] .incident-media-fallback {
  border-color: var(--gf-line);
  background: color-mix(in srgb, var(--gf-panel-soft) 86%, #0d1f24);
}

html[data-gestfel-theme="dark"] .incident-title-block h2,
html[data-gestfel-theme="dark"] .incident-facts-card h3,
html[data-gestfel-theme="dark"] .incident-summary-card h3,
html[data-gestfel-theme="dark"] .incident-history-card h3,
html[data-gestfel-theme="dark"] .incident-manage-card h3,
html[data-gestfel-theme="dark"] .incident-facts-card dd,
html[data-gestfel-theme="dark"] .incident-summary-kpis strong,
html[data-gestfel-theme="dark"] .incident-history-item strong,
html[data-gestfel-theme="dark"] .incident-workflow-help strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .incident-title-block p,
html[data-gestfel-theme="dark"] .incident-facts-card dt,
html[data-gestfel-theme="dark"] .incident-summary-kpis small,
html[data-gestfel-theme="dark"] .incident-history-item time,
html[data-gestfel-theme="dark"] .incident-history-item p,
html[data-gestfel-theme="dark"] .incident-admin-note p,
html[data-gestfel-theme="dark"] .incident-workflow-help small,
html[data-gestfel-theme="dark"] .incident-workflow-help span {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .app-icon-type-cat,
html[data-gestfel-theme="dark"] .app-icon-cat,
html[data-gestfel-theme="dark"] .app-icon-gato,
html[data-gestfel-theme="dark"] .app-icon-gatos {
  color: #c8ceff;
  background: rgba(130, 139, 228, .15);
}

.public-nav .brand,
.app-top .brand {
  gap: .72rem;
}

.app-icon,
.nav-icon,
.top-nav-icon,
.mobile-bottom-icon,
.kpi-icon,
.theme-toggle-icon {
  stroke-width: 2.15;
}

.top-nav-icon,
.desktop-top-more-summary .top-nav-icon,
.sidebar nav a .nav-icon,
.mobile-bottom-icon {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 12px;
  color: color-mix(in srgb, var(--gf-accent) 82%, #4852a5);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--gf-accent) 11%, #fff), #f7fffd);
  border: 1px solid color-mix(in srgb, var(--gf-accent) 24%, #d7e6e2);
  box-shadow:
    0 6px 14px rgba(15, 36, 55, .07),
    inset 0 1px 0 rgba(255, 255, 255, .88);
}

.desktop-top-nav a.active .top-nav-icon,
.desktop-top-nav a:hover .top-nav-icon,
.desktop-top-more[open] .top-nav-icon,
.mobile-bottom-item.active .mobile-bottom-icon {
  color: #4852a5;
  background:
    linear-gradient(145deg, #f1efff, color-mix(in srgb, var(--gf-accent) 10%, #fff));
  border-color: color-mix(in srgb, #7868d8 28%, var(--gf-line));
}

.module-pro-icon,
.card-icon,
.public-page .card-icon {
  width: 58px;
  height: 58px;
  border-radius: 19px;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--gf-accent) 78%, #5f59c7);
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, .95), transparent 34%),
    linear-gradient(145deg, color-mix(in srgb, var(--gf-accent) 16%, #fff), #f3f0ff);
  border: 1px solid color-mix(in srgb, var(--gf-accent) 25%, #d6e7e2);
  box-shadow:
    0 14px 26px rgba(15, 36, 55, .1),
    inset 0 1px 0 rgba(255, 255, 255, .9);
}

.module-pro-icon .app-icon,
.module-pro-icon svg,
.card-icon .app-icon,
.public-page .card-icon .app-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 0;
  color: currentColor;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.dashboard-command-kpis .kpi.card {
  grid-template-columns: 56px minmax(0, 1fr);
  column-gap: .58rem;
}

.dashboard-command-kpis .kpi-icon,
.dashboard-command-kpis svg.kpi-icon,
.clinical-summary-kpi > .app-icon,
.clinical-summary-kpi > svg,
.clinical-meta .app-icon,
.clinical-date .app-icon {
  width: 46px;
  height: 46px;
  padding: 10px;
  border-radius: 15px;
  color: color-mix(in srgb, var(--gf-accent) 80%, #5f59c7);
  background:
    radial-gradient(circle at 68% 14%, rgba(255, 255, 255, .9), transparent 36%),
    linear-gradient(145deg, color-mix(in srgb, var(--gf-accent) 16%, #fff), #f4f1ff);
  border: 1px solid color-mix(in srgb, var(--gf-accent) 24%, #d6e7e2);
  box-shadow: 0 10px 22px rgba(15, 36, 55, .08);
}

.cat-info-grid svg,
.cat-info-grid .app-icon,
.cats-workspace .cat-selection-notes article > span {
  width: 48px;
  height: 48px;
  padding: 10px;
  border-radius: 16px;
  color: color-mix(in srgb, var(--gf-accent) 74%, #5b54c9);
  background:
    radial-gradient(circle at 70% 18%, rgba(255, 255, 255, .95), transparent 35%),
    linear-gradient(145deg, color-mix(in srgb, var(--gf-accent) 15%, #fff), #f2f0ff);
  border: 1px solid color-mix(in srgb, var(--gf-accent) 26%, #d6e7e2);
  box-shadow:
    0 12px 22px rgba(15, 36, 55, .08),
    inset 0 1px 0 rgba(255, 255, 255, .88);
}

/* Todos los iconos de esta microficha (illustrated y generated) se
   homogeneizan a 46px, asi que la columna del icono es igual para todos
   los chips. El minimo de columna del grid (170px en la media query de
   820px) esta calculado para que el texto restante nunca fuerce cortes
   letra a letra con overflow-wrap:anywhere. */
.cat-info-grid span,
.cats-workspace .cat-info-grid span {
  grid-template-columns: 46px minmax(0, 1fr);
  column-gap: .78rem;
  align-items: center;
}

.cat-info-grid strong,
.cats-workspace .cat-info-grid strong {
  padding-left: 0;
}

.app-icon-type-health,
.app-icon-type-stethoscope,
.app-icon-type-clinic,
.app-icon-type-heart,
.app-icon-type-vaccine {
  color: #2479bd;
}

.app-icon-type-colony,
.app-icon-type-map,
.app-icon-type-pin,
.app-icon-type-location {
  color: #0f7f70;
}

.app-icon-type-report,
.app-icon-type-chart,
.app-icon-type-users,
.app-icon-type-team {
  color: #5a58bd;
}

.app-icon-type-alert,
.app-icon-type-task,
.app-icon-type-calendar {
  color: #9a6a12;
}

.app-illustrated-icon,
.app-generated-icon {
  display: inline-block;
  flex: 0 0 auto;
  overflow: visible;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.app-generated-icon {
  object-fit: contain;
  object-position: center;
  vertical-align: middle;
  border-radius: 12px !important;
  clip-path: inset(0 round 12px);
  overflow: hidden !important;
}

.top-nav-icon.app-illustrated-icon,
.top-nav-icon.app-generated-icon,
.desktop-top-more-summary .top-nav-icon.app-illustrated-icon,
.desktop-top-more-summary .top-nav-icon.app-generated-icon,
.desktop-top-more-menu .top-nav-icon.app-illustrated-icon,
.desktop-top-more-menu .top-nav-icon.app-generated-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 0;
}

.sidebar nav a .nav-icon.app-illustrated-icon,
.sidebar nav a .nav-icon.app-generated-icon,
.mobile-bottom-icon.app-illustrated-icon,
.mobile-bottom-icon.app-generated-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 0;
}

.module-pro-icon .app-illustrated-icon,
.module-pro-icon .app-generated-icon,
.card-icon .app-illustrated-icon,
.card-icon .app-generated-icon,
.public-page .card-icon .app-illustrated-icon {
  width: 58px;
  height: 58px;
  padding: 0;
}

.clinical-summary-kpi > .app-illustrated-icon,
.clinical-summary-kpi > .app-generated-icon,
.clinical-meta .app-illustrated-icon,
.clinical-meta .app-generated-icon,
.clinical-date .app-illustrated-icon {
  width: 58px;
  height: 58px;
  padding: 0;
}

.clinical-date .app-generated-icon {
  width: 34px;
  height: 34px;
  padding: 0;
}

/* Tamano unico para todos los iconos de la microficha, igualando el del
   icono de Sexo (.cat-detail-sex-icon, 46px) para que ningun chip
   destaque sobre el resto. */
.cat-info-grid .app-illustrated-icon,
.cat-info-grid .app-generated-icon {
  width: 46px;
  height: 46px;
  padding: 0;
}

.cats-workspace .cat-selection-notes article > .app-illustrated-icon {
  width: 58px;
  height: 58px;
  padding: 0;
}

.cat-info-grid span,
.cats-workspace .cat-info-grid span {
  grid-template-columns: 46px minmax(0, 1fr);
  column-gap: .8rem;
}

.cat-detail-sex-icon {
  display: grid;
  grid-row: 1 / span 2;
  place-items: center;
  width: 46px;
  height: 46px;
}

.cat-detail-sex-icon-option {
  grid-area: 1 / 1;
  width: 46px !important;
  height: 46px !important;
  opacity: 0;
  transform: scale(.92);
  transition: opacity .18s ease, transform .18s ease;
}

.cat-detail-sex-icon-option.is-active {
  opacity: 1;
  transform: scale(1);
}

html[data-gestfel-theme="dark"] .app-illustrated-icon,
html[data-gestfel-theme="dark"] .app-generated-icon {
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .22));
}

.top-nav-icon.app-generated-icon,
.desktop-top-more-summary .top-nav-icon.app-generated-icon,
.desktop-top-more-menu .top-nav-icon.app-generated-icon,
.sidebar nav a .nav-icon.app-generated-icon,
.mobile-bottom-icon.app-generated-icon {
  border-radius: 13px !important;
  clip-path: inset(0 round 13px);
}

.sidebar nav a .nav-icon.app-generated-icon,
.sidebar nav a .nav-icon.app-illustrated-icon {
  width: 54px;
  height: 54px;
  margin-inline: -3px .15rem;
}

.mobile-bottom-icon.app-generated-icon,
.mobile-bottom-icon.app-illustrated-icon {
  width: 38px;
  height: 38px;
  margin-top: -2px;
}

.module-pro-icon .app-generated-icon,
.card-icon .app-generated-icon,
.dashboard-command-kpis .app-generated-icon.kpi-icon,
.clinical-summary-kpi > .app-generated-icon,
.clinical-meta .app-generated-icon,
.cat-info-grid .app-generated-icon,
.clinical-kpi > span .app-generated-icon {
  border-radius: 14px;
  clip-path: inset(0 round 14px);
}

.colony-detail-hero .colony-detail-icon .app-illustrated-icon,
.colony-detail-hero .colony-detail-icon .app-generated-icon {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  flex-basis: 28px;
  border-radius: 8px;
  clip-path: inset(0 round 8px);
}

.colony-detail-hero .colony-detail-meta .app-illustrated-icon,
.colony-detail-hero .colony-detail-meta .app-generated-icon {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex-basis: 18px;
  border-radius: 5px;
  clip-path: inset(0 round 5px);
}

.colony-detail-overview .colony-detail-kpi > span .app-illustrated-icon,
.colony-detail-overview .colony-detail-kpi > span .app-generated-icon {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  flex-basis: 24px;
  border-radius: 7px;
  clip-path: inset(0 round 7px);
}

.incident-detail-shell .incident-detail-icon .app-illustrated-icon,
.incident-detail-shell .incident-detail-icon .app-generated-icon {
  width: 30px;
  height: 30px;
  max-width: 30px;
  max-height: 30px;
  flex-basis: 30px;
  border-radius: 8px;
  clip-path: inset(0 round 8px);
}

.incident-detail-shell .incident-status-card .app-illustrated-icon,
.incident-detail-shell .incident-status-card .app-generated-icon {
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
  flex-basis: 22px;
  border-radius: 6px;
  clip-path: inset(0 round 6px);
}

.incident-detail-shell .incident-facts-card dt .app-illustrated-icon,
.incident-detail-shell .incident-facts-card dt .app-generated-icon {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  flex-basis: 24px;
  border-radius: 7px;
  clip-path: inset(0 round 7px);
}

.incident-detail-shell .incident-summary-kpis .app-illustrated-icon,
.incident-detail-shell .incident-summary-kpis .app-generated-icon {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  flex-basis: 28px;
  border-radius: 8px;
  clip-path: inset(0 round 8px);
}

.clinical-meta .app-illustrated-icon,
.clinical-meta .app-generated-icon,
.clinical-date .app-illustrated-icon,
.clinical-date .app-generated-icon {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex-basis: 18px;
  border-radius: 5px;
  clip-path: inset(0 round 5px);
}

.clinical-hero-fallback .app-illustrated-icon,
.clinical-hero-fallback .app-generated-icon,
.clinical-doc-thumb .app-illustrated-icon,
.clinical-doc-thumb .app-generated-icon {
  width: 34px;
  height: 34px;
  max-width: 34px;
  max-height: 34px;
  flex-basis: 34px;
  border-radius: 9px;
  clip-path: inset(0 round 9px);
}

html[data-gestfel-theme="dark"] .top-nav-icon,
html[data-gestfel-theme="dark"] .desktop-top-more-summary .top-nav-icon,
html[data-gestfel-theme="dark"] .sidebar nav a .nav-icon,
html[data-gestfel-theme="dark"] .mobile-bottom-icon,
html[data-gestfel-theme="dark"] .module-pro-icon,
html[data-gestfel-theme="dark"] .card-icon,
html[data-gestfel-theme="dark"] .public-page .card-icon,
html[data-gestfel-theme="dark"] .dashboard-command-kpis .kpi-icon,
html[data-gestfel-theme="dark"] .dashboard-command-kpis svg.kpi-icon,
html[data-gestfel-theme="dark"] .clinical-summary-kpi > .app-icon,
html[data-gestfel-theme="dark"] .clinical-summary-kpi > svg,
html[data-gestfel-theme="dark"] .clinical-meta .app-icon,
html[data-gestfel-theme="dark"] .clinical-date .app-icon,
html[data-gestfel-theme="dark"] .cat-info-grid svg,
html[data-gestfel-theme="dark"] .cat-info-grid .app-icon,
html[data-gestfel-theme="dark"] .cats-workspace .cat-selection-notes article > span {
  color: #bff5ed;
  background:
    linear-gradient(145deg, rgba(111, 214, 199, .16), rgba(255, 255, 255, .04));
  border-color: rgba(151, 226, 214, .28);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, .2),
    inset 0 1px 0 rgba(255, 255, 255, .06);
}

html[data-gestfel-theme="dark"] .public-page h1,
html[data-gestfel-theme="dark"] .public-page h2,
html[data-gestfel-theme="dark"] .public-page h3,
html[data-gestfel-theme="dark"] .public-page strong,
html[data-gestfel-theme="dark"] .public-page .pic-stat strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .public-page p,
html[data-gestfel-theme="dark"] .public-page li,
html[data-gestfel-theme="dark"] .public-page .mini-benefits span,
html[data-gestfel-theme="dark"] .public-page .pic-header,
html[data-gestfel-theme="dark"] .public-page .pic-stat span {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .public-hero,
html[data-gestfel-theme="dark"] #que-hacemos,
html[data-gestfel-theme="dark"] #colabora,
html[data-gestfel-theme="dark"] .public-page .section {
  background: transparent;
}

html[data-gestfel-theme="dark"] .public-impact-card,
html[data-gestfel-theme="dark"] .pic-stat,
html[data-gestfel-theme="dark"] .pic-bar-section,
html[data-gestfel-theme="dark"] .pic-mini-stat,
html[data-gestfel-theme="dark"] .pic-secondary-stats span,
html[data-gestfel-theme="dark"] .pic-footer span,
html[data-gestfel-theme="dark"] .public-health-metrics .metric,
html[data-gestfel-theme="dark"] .public-page .card,
html[data-gestfel-theme="dark"] .public-page #que-hacemos .card,
html[data-gestfel-theme="dark"] .public-page #colabora .card,
html[data-gestfel-theme="dark"] .public-page #transparencia .card,
html[data-gestfel-theme="dark"] .public-hero .mini-benefits span {
  background: linear-gradient(180deg, #172b31, #13262c);
  color: var(--gf-text);
  border-color: var(--gf-line);
  box-shadow: 0 18px 36px rgba(0, 0, 0, .26);
}

html[data-gestfel-theme="dark"] .pic-stat strong,
html[data-gestfel-theme="dark"] .pic-stat--accent strong,
html[data-gestfel-theme="dark"] .pic-mini-stat strong,
html[data-gestfel-theme="dark"] .public-health-metrics .metric strong {
  color: #bff5ed;
  text-shadow: none;
}

html[data-gestfel-theme="dark"] .pic-stat span,
html[data-gestfel-theme="dark"] .pic-mini-stat span,
html[data-gestfel-theme="dark"] .pic-bar-label,
html[data-gestfel-theme="dark"] .public-health-metrics .metric span {
  color: #a8c5bf;
}

html[data-gestfel-theme="dark"] .pic-bar-track {
  background: rgba(255, 255, 255, .12);
}

html[data-gestfel-theme="dark"] .public-health-metrics .metric:hover,
html[data-gestfel-theme="dark"] .public-impact-card:hover {
  border-color: rgba(151, 226, 214, .42);
  background: linear-gradient(180deg, #1a3137, #14272d);
}

html[data-gestfel-theme="dark"] .public-page canvas.chart-canvas {
  background: var(--gf-page-bg);
  border: 1px solid var(--gf-line);
  border-radius: 12px;
}

html[data-gestfel-theme="dark"] .public-page .card p,
html[data-gestfel-theme="dark"] .public-page #que-hacemos .card p,
html[data-gestfel-theme="dark"] .public-page #colabora .card p,
html[data-gestfel-theme="dark"] .public-page #transparencia .card p {
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .public-hero .hero-actions .btn-outline,
html[data-gestfel-theme="dark"] .public-page #colabora .btn-outline {
  background: #102026;
  color: #bff5ed;
  border-color: var(--gf-line-strong);
}

/* Public page rhythm: remove empty vertical gaps and keep cards operational. */
.public-page .public-hero {
  min-height: min(590px, calc(100dvh - 74px));
  padding-top: clamp(34px, 5vw, 58px);
  padding-bottom: clamp(26px, 4vw, 44px);
  gap: clamp(2rem, 5vw, 4.8rem);
}

.public-page .public-impact-card {
  align-self: center;
  max-width: 560px;
  justify-self: end;
}

.public-page .public-metrics-section {
  padding-top: clamp(26px, 3.4vw, 42px);
  padding-bottom: clamp(28px, 3.4vw, 46px);
}

.public-page .section {
  padding-top: clamp(28px, 3.8vw, 48px);
  padding-bottom: clamp(28px, 3.8vw, 52px);
}

.public-page #que-hacemos {
  padding-top: clamp(28px, 3.6vw, 44px);
}

.public-page #transparencia,
.public-page #colabora {
  padding-top: clamp(28px, 3.5vw, 44px);
}

.public-page .public-health-metrics .metric {
  min-height: 118px;
  padding: 1.05rem .9rem;
}

.public-page #que-hacemos .card,
.public-page #colabora .card,
.public-page #transparencia .card {
  height: 100%;
}

.public-page #colabora .card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  min-height: 168px;
}

.public-page .pic-footer {
  display: flex;
  min-height: 40px;
  align-items: center;
}

.public-page .pic-footer span {
  width: 100%;
}

.public-page .hero-actions .app-graphic-icon,
.public-page .mini-benefits .app-graphic-icon,
.public-page .pic-footer .app-graphic-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

/* Public dark polish: no visible grid lines and no white icon tiles. */
.public-page .public-clean-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  padding: 0;
  color: currentColor;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
}

.public-page .card-icon .public-clean-icon {
  width: 34px;
  height: 34px;
}

html[data-gestfel-theme="dark"] body.public-page {
  background:
    radial-gradient(circle at 22% 9%, rgba(111, 214, 199, .08), transparent 34%),
    linear-gradient(180deg, #0d1d21 0%, #09191d 48%, #071518 100%);
}

html[data-gestfel-theme="dark"] body.public-page::before,
html[data-gestfel-theme="dark"] .public-hero::before {
  opacity: 0;
}

html[data-gestfel-theme="dark"] .public-page .public-clean-icon {
  color: #c8fff5;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-gestfel-theme="dark"] .public-page .btn-outline .public-clean-icon,
html[data-gestfel-theme="dark"] .public-page .mini-benefits .public-clean-icon,
html[data-gestfel-theme="dark"] .public-page .pic-footer .public-clean-icon {
  color: #8fe8dc;
}

html[data-gestfel-theme="dark"] .public-page .btn-primary .public-clean-icon {
  color: #ffffff;
}

html[data-gestfel-theme="dark"] .public-page .pic-footer {
  background: transparent;
  border-color: transparent;
  padding: 0;
}

html[data-gestfel-theme="dark"] .public-page .pic-footer span {
  background: rgba(200, 255, 245, .08);
  color: var(--gf-text);
  border: 1px solid rgba(200, 255, 245, .22);
  border-radius: 10px;
  box-shadow: none;
}

html[data-gestfel-theme="dark"] .public-hero .mini-benefits span {
  background: rgba(200, 255, 245, .07);
  border-color: rgba(200, 255, 245, .18);
  box-shadow: none;
}

@media (max-width: 760px) {
  .theme-toggle span {
    display: none;
  }

  .theme-toggle {
    min-width: 38px;
    padding-inline: .5rem;
  }

  .public-nav .theme-toggle {
    order: 2;
  }

  .public-nav .nav-toggle {
    order: 3;
  }

  .public-nav {
    z-index: 1200;
  }

  .public-nav:has(.nav-links.open)::after {
    content: "";
    position: fixed;
    inset: 74px 0 0;
    z-index: 0;
    background: rgba(15, 36, 55, .18);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    pointer-events: none;
  }

  .public-nav .nav-links {
    position: fixed;
    top: calc(74px + .85rem);
    left: max(1rem, env(safe-area-inset-left));
    right: max(1rem, env(safe-area-inset-right));
    z-index: 2;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
    padding: .85rem;
    border: 1px solid color-mix(in srgb, var(--gf-accent) 22%, #dbe7e3);
    border-radius: 22px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(247, 252, 250, .96));
    box-shadow:
      0 28px 70px rgba(15, 36, 55, .24),
      0 0 0 1px rgba(255, 255, 255, .72) inset;
  }

  .public-nav .nav-links.open {
    display: flex;
  }

  .public-nav .nav-links a,
  .public-nav .nav-links .btn,
  .public-nav .nav-links .theme-toggle {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    border-radius: 14px;
    color: var(--gf-text);
  }

  .public-nav .nav-links > a:not(.btn) {
    border: 1px solid transparent;
    background: color-mix(in srgb, var(--gf-accent) 5%, #fff);
    color: color-mix(in srgb, var(--gf-text) 92%, var(--gf-accent));
    font-weight: 850;
    text-decoration: none;
  }

  .public-nav .nav-links > a:not(.btn):hover,
  .public-nav .nav-links > a:not(.btn):focus-visible {
    border-color: color-mix(in srgb, var(--gf-accent) 18%, #dbe7e3);
    background: color-mix(in srgb, var(--gf-accent) 10%, #fff);
    color: var(--gf-accent);
  }

  .public-nav .nav-links .btn-outline {
    background: #102026;
    border-color: var(--gf-accent);
    color: var(--gf-accent);
  }

  .public-nav .nav-links .btn-primary {
    color: #fff;
  }

  .public-nav .nav-links .theme-toggle {
    min-width: 0;
    background: color-mix(in srgb, var(--gf-accent) 64%, #fff);
    color: #fff;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--gf-accent) 20%, transparent);
  }

  html[data-gestfel-theme="dark"] .public-nav:has(.nav-links.open)::after {
    background: rgba(2, 8, 12, .46);
  }

  html[data-gestfel-theme="dark"] .public-nav .nav-links {
    border-color: var(--gf-line-strong);
    background:
      linear-gradient(180deg, rgba(22, 43, 49, .98), rgba(14, 30, 36, .98));
    box-shadow:
      0 30px 80px rgba(0, 0, 0, .48),
      0 0 0 1px rgba(255, 255, 255, .05) inset;
  }

  html[data-gestfel-theme="dark"] .public-nav .nav-links > a:not(.btn) {
    background: rgba(111, 214, 199, .08);
    border-color: rgba(111, 214, 199, .1);
    color: var(--gf-text);
  }

  html[data-gestfel-theme="dark"] .public-nav .nav-links > a:not(.btn):hover,
  html[data-gestfel-theme="dark"] .public-nav .nav-links > a:not(.btn):focus-visible {
    background: rgba(111, 214, 199, .14);
    border-color: rgba(111, 214, 199, .25);
    color: #dffff9;
  }

  html[data-gestfel-theme="dark"] .public-nav .nav-links .btn-outline {
    background: #0c1d22;
    color: #bff5ed;
    border-color: rgba(111, 214, 199, .55);
  }

  html[data-gestfel-theme="dark"] .public-nav .nav-links .theme-toggle {
    background: color-mix(in srgb, var(--gf-accent) 74%, #0c1d22);
    color: #fff;
  }
}
/* =========================
   Tareas: acciones en línea (móvil) y filas legibles en modo oscuro
   ========================= */

/* La capa tables (`.table td.actions > form { display:grid }`) pisaba el
   display:contents previsto en 30-mobile-modules (capa modules); esta capa
   carga después y recupera la fila de acciones compacta. */
@media (max-width: 720px) {
  .tasks-table td.task-actions-cell > form,
  .tasks-table td.task-actions-cell .task-status-form {
    display: contents;
  }
}

/* Tareas: agrupación por categoría y subcategoría */
.task-groups {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.task-category-group {
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  overflow: hidden;
}

.task-category-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .8rem 1rem;
  cursor: pointer;
  list-style: none;
  background: rgba(11, 125, 109, .06);
}

.task-category-group > summary::-webkit-details-marker {
  display: none;
}

.task-category-group > summary h3 {
  margin: 0;
  font-size: 1rem;
}

.task-subcategory-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .5rem .6rem;
  padding: .75rem 1rem 1rem;
}

.task-subcategory-group {
  flex: 0 1 auto;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: rgba(11, 125, 109, .05);
  overflow: hidden;
}

.task-subcategory-group[open] {
  flex-basis: 100%;
  border-radius: 14px;
}

.task-subcategory-group > summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .9rem;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
}

.task-subcategory-group > summary::-webkit-details-marker {
  display: none;
}

.task-count-badge {
  flex: none;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: var(--brand-border);
  color: var(--brand-dark);
  font-size: .8rem;
  font-weight: 700;
}

.task-count-badge--sub {
  background: rgba(11, 125, 109, .14);
}

html[data-gestfel-theme="dark"] .task-category-group > summary {
  background: rgba(111, 214, 199, .08);
}

html[data-gestfel-theme="dark"] .task-subcategory-group {
  background: rgba(111, 214, 199, .06);
}

html[data-gestfel-theme="dark"] .task-subcategory-group > summary {
  color: #dffff9;
}

html[data-gestfel-theme="dark"] .task-count-badge {
  background: rgba(111, 214, 199, .18);
  color: #dffff9;
}

@media (max-width: 720px) {
  .task-subcategory-group > summary {
    white-space: normal;
  }
}

/* Inventario: agrupación de materiales por categoría (mismo lenguaje visual que las tareas) */
.inventory-category-groups {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.inventory-category-group {
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  overflow: hidden;
}

.inventory-category-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .8rem 1rem;
  cursor: pointer;
  list-style: none;
  background: rgba(11, 125, 109, .06);
  font-weight: 700;
  color: var(--brand-dark);
}

.inventory-category-group > summary::-webkit-details-marker {
  display: none;
}

.inventory-category-label {
  font-size: 1rem;
}

.inventory-category-meta {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.inventory-count-badge {
  flex: none;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: var(--brand-border);
  color: var(--brand-dark);
  font-size: .8rem;
  font-weight: 700;
}

.inventory-count-badge--low {
  background: rgba(217, 119, 6, .16);
  color: #92400e;
}

html[data-gestfel-theme="dark"] .inventory-category-group > summary {
  background: rgba(111, 214, 199, .08);
  color: #dffff9;
}

html[data-gestfel-theme="dark"] .inventory-count-badge {
  background: rgba(111, 214, 199, .18);
  color: #dffff9;
}

html[data-gestfel-theme="dark"] .inventory-count-badge--low {
  background: rgba(217, 119, 6, .28);
  color: #fde68a;
}

/* Inventario: subchips de colonia dentro de cada categoría de materiales asignados */
.inventory-colony-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .5rem .6rem;
  padding: .75rem 1rem 1rem;
}

.inventory-colony-group {
  flex: 0 1 auto;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: rgba(11, 125, 109, .05);
  overflow: hidden;
}

.inventory-colony-group[open] {
  flex-basis: 100%;
  border-radius: 14px;
}

.inventory-colony-group > summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .9rem;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
}

.inventory-colony-group > summary::-webkit-details-marker {
  display: none;
}

html[data-gestfel-theme="dark"] .inventory-colony-group {
  background: rgba(111, 214, 199, .06);
}

html[data-gestfel-theme="dark"] .inventory-colony-group > summary {
  color: #dffff9;
}

@media (max-width: 720px) {
  .inventory-colony-group > summary {
    white-space: normal;
  }
}

.inventory-assignments-table td.inventory-actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  min-width: 9rem;
}

.inventory-assignments-table td.inventory-actions-cell form {
  display: contents;
}

.inventory-assignments-table td.inventory-actions-cell .btn {
  padding: .32rem .6rem;
  font-size: .8rem;
}

/* Las filas de la tabla de tareas conservaban fondos claros fijos en modo oscuro
   y el texto claro resultaba ilegible sobre ellos. */
html[data-gestfel-theme="dark"] .tasks-table td {
  background: #12242a;
  border-top-color: var(--gf-line);
  border-bottom-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .tasks-table tr:not(:first-child) td:last-child {
  border-right-color: var(--gf-line);
}

html[data-gestfel-theme="dark"] .tasks-table tr.urgency--green td {
  background: #10282a;
}

html[data-gestfel-theme="dark"] .tasks-table tr.urgency--yellow td {
  background: #262013;
}

html[data-gestfel-theme="dark"] .tasks-table tr.urgency--red td {
  background: #2b1714;
  border-top-color: rgba(239, 111, 97, .3);
  border-bottom-color: rgba(239, 111, 97, .3);
}

html[data-gestfel-theme="dark"] .tasks-table tr.task-status--completada td,
html[data-gestfel-theme="dark"] .tasks-table tr.task-status--cancelada td {
  background: #14212a;
  color: var(--gf-muted);
}

html[data-gestfel-theme="dark"] .tasks-table td:first-child strong {
  color: var(--gf-text);
}

html[data-gestfel-theme="dark"] .tasks-table tr.priority--baja:not(.urgency--red):not(.urgency--yellow) td {
  color: var(--gf-muted);
}

/* =========================================================
   Memorial de animales fallecidos
   ========================================================= */
.memorial-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: linear-gradient(135deg, rgba(11,125,109,.08), rgba(244,162,97,.12));
  border-color: rgba(11,125,109,.18);
}
.memorial-hero-icon {
  display: grid;
  place-items: center;
  flex: 0 0 3.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  color: #b97827;
  background: rgba(244,162,97,.18);
  font-size: 1.65rem;
}
.memorial-hero .eyebrow,
.memorial-date {
  margin: 0 0 .35rem;
  color: var(--gf-muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.memorial-hero h2 { margin: 0 0 .45rem; color: var(--gf-text); }
.memorial-hero p:last-child { max-width: 58rem; margin: 0; color: var(--gf-muted); line-height: 1.65; }
.memorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
}
.memorial-card {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  overflow: hidden;
  padding: 0;
}
.memorial-card-photo { min-height: 220px; background: var(--gf-page-bg); }
.memorial-card-photo img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.82); }
.memorial-card-body { padding: 1.1rem 1.2rem 1.25rem; }
.memorial-card h3 { margin: 0; color: var(--gf-text); font-size: 1.35rem; }
.memorial-colony { margin: .2rem 0 .9rem; color: var(--gf-muted); font-size: .85rem; }
.memorial-card blockquote {
  margin: 0 0 .9rem;
  padding-left: .9rem;
  border-left: 3px solid rgba(244,162,97,.55);
  color: var(--gf-text);
  font-family: Georgia, serif;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.55;
}
.memorial-card small { color: var(--gf-muted); }
.memorial-history-link { display: inline-flex; margin-top: 1rem; }
.memorial-empty { grid-column: 1 / -1; padding: 2rem; text-align: center; }
@media (max-width: 640px) {
  .memorial-hero { align-items: flex-start; }
  .memorial-hero-icon { flex-basis: 2.8rem; width: 2.8rem; height: 2.8rem; }
  .memorial-card { grid-template-columns: 1fr; }
  .memorial-card-photo { min-height: 0; height: 210px; }
}

html[data-gestfel-theme="dark"] .memorial-hero {
  background: linear-gradient(135deg, #132e31, #2b261d);
  border-color: rgba(133, 211, 192, .2);
}
html[data-gestfel-theme="dark"] .memorial-hero-icon { color: #f3bf76; background: rgba(244,162,97,.14); }
.deceased-history-note { display: flex; gap: .65rem; align-items: baseline; margin-bottom: 1rem; border-color: rgba(244,162,97,.38); background: color-mix(in srgb, var(--gf-panel) 88%, #f4a261 12%); }
.deceased-history-note strong { color: var(--gf-text); }
.deceased-history-note span { color: var(--gf-muted); }

.food-network-panel { margin-bottom: 1rem; }
.food-network-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .75rem;
  margin: 1rem 0;
}
.food-network-filter label { min-width: 160px; flex: 0 1 190px; }
.food-network-filter button { margin-bottom: 0; }
.food-network-kpis { margin: .5rem 0 1rem; }
.food-network-summary-table th,
.food-network-summary-table td { white-space: nowrap; }
.food-network-summary-table .food-network-row--empty { background: color-mix(in srgb, var(--gf-panel) 88%, #f4a261 12%); }
.food-network-detail { margin-top: 1rem; border-top: 1px solid var(--gf-line); padding-top: .85rem; }
.food-network-detail summary { cursor: pointer; color: var(--gf-accent); font-weight: 700; }
@media (max-width: 720px) {
  .food-network-filter label { min-width: 0; flex-basis: calc(50% - .4rem); }
  .food-network-filter button { width: 100%; }
  .food-network-summary-table th,
  .food-network-summary-table td { white-space: normal; }
}

/* =========================================================
   Administración del servidor
   ========================================================= */
.admin-server-head { margin-bottom: 1.1rem; }
.admin-server-head h1 { font-size: clamp(1.8rem, 3vw, 2.7rem); }
.admin-server-head p { max-width: 70rem; margin-bottom: 0; }
.admin-server-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.admin-server-card {
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.25rem 1.35rem 1.35rem;
}
.admin-server-card h2 {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 0 0 .85rem;
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  line-height: 1.15;
}
.admin-server-card h2 .admin-server-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  padding: 0;
}
.admin-server-card p {
  min-height: 3.2rem;
  margin: 0 0 1rem;
  color: var(--gf-muted);
  line-height: 1.45;
}
.admin-server-card .btn { margin-top: auto; }
@media (max-width: 900px) {
  .admin-server-grid { grid-template-columns: 1fr; }
  .admin-server-card { padding: 1.15rem 1.2rem 1.2rem; }
  .admin-server-card p { min-height: 0; }
}

} /* end @layer theme */
