/* Botones modernos para menús - Médicos Generales Colombianos */
.mgcb {
  --mgcb-radio: 999px;
  --mgcb-pad-y: .62rem;
  --mgcb-pad-x: 1.15rem;
  --mgcb-fuente: .9rem;
  --mgcb-gap: .55rem;
  --mgcb-sombra: 0 2px 6px rgba(11, 26, 51, .12);
  --mgcb-sombra-hover: 0 8px 20px rgba(11, 26, 51, .22);
  font-family: inherit;
  padding: .5rem 0;
}
.mgcb--pequeno { --mgcb-pad-y: .45rem; --mgcb-pad-x: .9rem; --mgcb-fuente: .8rem; --mgcb-gap: .4rem; }
.mgcb--grande  { --mgcb-pad-y: .85rem; --mgcb-pad-x: 1.45rem; --mgcb-fuente: 1.02rem; --mgcb-gap: .7rem; }

.mgcb__lista {
  list-style: none;
  margin: 0;
  padding: .35rem .25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: var(--mgcb-alinear, center);
  gap: var(--mgcb-gap);
}
.mgcb__item { position: relative; margin: 0; padding: 0; list-style: none; }

/* --- Píldora --- */
.mgcb__pill,
.mgcb__pill--doble {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border-radius: var(--mgcb-radio);
  font-size: var(--mgcb-fuente);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .01em;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease, border-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.mgcb__pill { padding: var(--mgcb-pad-y) var(--mgcb-pad-x); border: 2px solid transparent; font-family: inherit; }
.mgcb__pill--doble { padding: 0; border: 2px solid transparent; overflow: hidden; }
.mgcb__pill--doble .mgcb__link {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: var(--mgcb-pad-y) .55rem var(--mgcb-pad-y) var(--mgcb-pad-x);
  color: inherit; text-decoration: none !important;
}
.mgcb__toggle--solo {
  display: inline-flex; align-items: center; justify-content: center;
  align-self: stretch;
  padding: 0 .85rem 0 .6rem;
  border: 0; border-left: 1px solid currentColor;
  border-left-color: color-mix(in srgb, currentColor 30%, transparent);
  background: transparent; color: inherit; cursor: pointer; font: inherit;
}
.mgcb__icono { font-size: 1.05em; width: 1.15em; text-align: center; color: var(--mgcb-acento); transition: transform .2s ease; }
.mgcb__caret { font-size: .7em; transition: transform .2s ease; }
.mgcb__toggle[aria-expanded="true"] .mgcb__caret { transform: rotate(180deg); }

/* Relleno (por defecto) */
.mgcb--relleno .mgcb__pill,
.mgcb--relleno .mgcb__pill--doble { background: var(--mgcb-color); color: #fff; box-shadow: var(--mgcb-sombra); }
.mgcb--relleno .mgcb__pill:hover,
.mgcb--relleno .mgcb__pill--doble:hover,
.mgcb--relleno .mgcb__pill:focus-visible,
.mgcb--relleno .is-abierto > .mgcb__pill,
.mgcb--relleno .is-abierto > .mgcb__pill--doble { background: var(--mgcb-activo); color: #fff; box-shadow: var(--mgcb-sombra-hover); transform: translateY(-2px); }
.mgcb--relleno .is-activo > .mgcb__pill,
.mgcb--relleno .is-activo > .mgcb__pill--doble { background: var(--mgcb-activo); box-shadow: inset 0 -3px 0 var(--mgcb-acento), var(--mgcb-sombra); }

/* Suave: fondo claro del color de marca */
.mgcb--suave .mgcb__pill,
.mgcb--suave .mgcb__pill--doble { background: color-mix(in srgb, var(--mgcb-color) 12%, #fff); color: var(--mgcb-color); }
.mgcb--suave .mgcb__icono { color: var(--mgcb-color); }
.mgcb--suave .mgcb__pill:hover,
.mgcb--suave .mgcb__pill--doble:hover,
.mgcb--suave .mgcb__pill:focus-visible,
.mgcb--suave .is-abierto > .mgcb__pill,
.mgcb--suave .is-abierto > .mgcb__pill--doble,
.mgcb--suave .is-activo > .mgcb__pill,
.mgcb--suave .is-activo > .mgcb__pill--doble { background: var(--mgcb-color); color: #fff; box-shadow: var(--mgcb-sombra-hover); transform: translateY(-2px); }
.mgcb--suave .mgcb__pill:hover .mgcb__icono,
.mgcb--suave .mgcb__pill--doble:hover .mgcb__icono,
.mgcb--suave .is-abierto .mgcb__pill .mgcb__icono,
.mgcb--suave .is-activo > .mgcb__pill .mgcb__icono,
.mgcb--suave .is-activo > .mgcb__pill--doble .mgcb__icono { color: var(--mgcb-acento); }

/* Contorno */
.mgcb--contorno .mgcb__pill,
.mgcb--contorno .mgcb__pill--doble { background: #fff; color: var(--mgcb-color); border-color: var(--mgcb-color); }
.mgcb--contorno .mgcb__icono { color: var(--mgcb-color); }
.mgcb--contorno .mgcb__pill:hover,
.mgcb--contorno .mgcb__pill--doble:hover,
.mgcb--contorno .mgcb__pill:focus-visible,
.mgcb--contorno .is-abierto > .mgcb__pill,
.mgcb--contorno .is-abierto > .mgcb__pill--doble,
.mgcb--contorno .is-activo > .mgcb__pill,
.mgcb--contorno .is-activo > .mgcb__pill--doble { background: var(--mgcb-color); color: #fff; box-shadow: var(--mgcb-sombra-hover); transform: translateY(-2px); }
.mgcb--contorno .mgcb__pill:hover .mgcb__icono,
.mgcb--contorno .mgcb__pill--doble:hover .mgcb__icono,
.mgcb--contorno .is-abierto .mgcb__icono,
.mgcb--contorno .is-activo > * .mgcb__icono { color: var(--mgcb-acento); }

.mgcb__pill:hover .mgcb__icono, .mgcb__pill--doble:hover .mgcb__icono { transform: scale(1.12); }
.mgcb__pill:focus-visible, .mgcb__link:focus-visible, .mgcb__toggle--solo:focus-visible, .mgcb__sublink:focus-visible {
  outline: 3px solid var(--mgcb-acento); outline-offset: 2px;
}
.mgcb .is-sin-enlace { cursor: default; }

/* --- Panel desplegable (lo posiciona el JS con position: fixed) --- */
.mgcb__panel {
  position: fixed;
  z-index: 1050;
  min-width: 230px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(70vh, 480px);
  overflow-y: auto;
  margin: 0;
  padding: .4rem;
  list-style: none;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 14px 38px rgba(11, 26, 51, .22), 0 2px 6px rgba(11, 26, 51, .08);
  border-top: 3px solid var(--mgcb-acento);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease;
}
.mgcb__panel.is-visible { opacity: 1; transform: translateY(0); }
.mgcb__panel[hidden] { display: none !important; }
.mgcb__subitem { list-style: none; margin: 0; }
.mgcb__sublink {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .75rem;
  border-radius: 10px;
  color: #23324a !important;
  font-size: .88rem; font-weight: 500; line-height: 1.25;
  text-decoration: none !important;
  transition: background-color .15s ease, color .15s ease, padding-left .15s ease;
}
.mgcb__sublink .mgcb__icono { color: var(--mgcb-color); font-size: .95em; }
.mgcb__sublink:hover, .mgcb__sublink:focus-visible { background: color-mix(in srgb, var(--mgcb-color) 10%, #fff); color: var(--mgcb-color) !important; padding-left: 1rem; }
.mgcb__sublink.is-actual { background: color-mix(in srgb, var(--mgcb-color) 14%, #fff); color: var(--mgcb-color) !important; font-weight: 700; }
.mgcb__anidado { list-style: none; margin: .1rem 0 .3rem 1.1rem; padding: 0 0 0 .5rem; border-left: 2px solid color-mix(in srgb, var(--mgcb-color) 20%, #fff); }
.mgcb__anidado .mgcb__sublink { font-size: .84rem; padding: .4rem .6rem; }

/* --- Celular --- */
@media (max-width: 767px) {
  .mgcb--movil-desplazar .mgcb__lista {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: .6rem;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
            mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .mgcb--movil-desplazar .mgcb__lista::-webkit-scrollbar { display: none; }
  .mgcb--movil-desplazar .mgcb__item { scroll-snap-align: start; flex: 0 0 auto; }
  .mgcb--movil-envolver .mgcb__lista { justify-content: center; }

  /* Cuadrícula: 2 columnas del mismo ancho, todos los botones visibles */
  .mgcb--movil-cuadricula .mgcb__lista {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    padding: .35rem 0;
  }
  .mgcb--movil-cuadricula .mgcb__item { display: flex; min-width: 0; }
  .mgcb--movil-cuadricula .mgcb__pill,
  .mgcb--movil-cuadricula .mgcb__pill--doble {
    width: 100%;
    min-height: 3rem;
    white-space: normal;
    text-align: left;
    border-radius: 14px;
  }
  .mgcb--movil-cuadricula .mgcb__pill { padding: .55rem .75rem; justify-content: flex-start; }
  .mgcb--movil-cuadricula .mgcb__pill--doble .mgcb__link { flex: 1 1 0; min-width: 0; justify-content: flex-start; padding: .55rem .3rem .55rem .75rem; }
  .mgcb--movil-cuadricula .mgcb__toggle--solo { flex: 0 0 auto; padding: 0 .5rem; }
  .mgcb--movil-cuadricula .mgcb__toggle .mgcb__caret { margin-left: auto; }
  .mgcb--movil-cuadricula .mgcb__texto { min-width: 0; overflow-wrap: break-word; hyphens: auto; line-height: 1.2; }
  .mgcb--movil-cuadricula .mgcb__pill,
  .mgcb--movil-cuadricula .mgcb__pill--doble .mgcb__link { gap: .45rem; }
  .mgcb--movil-cuadricula .mgcb__icono { flex: 0 0 auto; }
  .mgcb { --mgcb-fuente: .84rem; --mgcb-pad-y: .55rem; --mgcb-pad-x: 1rem; }
  .mgcb--movil-cuadricula { --mgcb-fuente: .8rem; }
  .mgcb__pill:hover, .mgcb__pill--doble:hover { transform: none !important; }
}

@media (max-width: 380px) {
  .mgcb--movil-cuadricula { --mgcb-fuente: .74rem; }
  .mgcb--movil-cuadricula .mgcb__lista { gap: .4rem; }
  .mgcb--movil-cuadricula .mgcb__pill { padding: .5rem .55rem; }
  .mgcb--movil-cuadricula .mgcb__pill--doble .mgcb__link { padding: .5rem .2rem .5rem .55rem; }
  .mgcb--movil-cuadricula .mgcb__toggle--solo { padding: 0 .4rem; }
  .mgcb--movil-cuadricula .mgcb__pill,
  .mgcb--movil-cuadricula .mgcb__pill--doble .mgcb__link { gap: .35rem; }
  .mgcb--movil-cuadricula .mgcb__texto { hyphens: manual; }
}

@media (max-width: 335px) {
  .mgcb--movil-cuadricula .mgcb__lista { grid-template-columns: minmax(0, 1fr); }
  .mgcb--movil-cuadricula { --mgcb-fuente: .82rem; }
  .mgcb--movil-cuadricula .mgcb__pill { min-height: 2.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .mgcb *, .mgcb__panel { transition: none !important; }
}
