/*
 * PSICOLE ↔ Web staging integration surface.
 * Institutional tokens only: no gradients, badges or data that are not
 * returned by the read-only PSICOLE integration contract.
 */
:root {
  --cpm-integration-navy: #1a2e4a;
  --cpm-integration-indigo: #4338ca;
  --cpm-integration-purple: #54277f;
  --cpm-integration-green: #059669;
  --cpm-integration-amber: #d97706;
  --cpm-integration-border: #e5e7eb;
  --cpm-integration-soft: #f8fafc;
}

/* The bridge hides the public login/fee actions once the PSICOLE session is
 * known. Keep the hidden state out of the flex width calculation as well, so
 * authenticated headers never introduce horizontal overflow. */
body .cpm-actions .cpm-login-link[hidden],
body .cpm-actions .cpm-button--primary[hidden] {
  display: none !important;
}

body .cpm-account-panel {
  width: min(336px, calc(100vw - 28px));
  z-index: 3220;
  padding: 10px;
  border-color: rgba(67, 56, 202, .16);
  border-radius: 18px;
  background: rgba(255, 255, 255, .985);
  box-shadow: 0 24px 64px rgba(15, 30, 49, .17), 0 4px 12px rgba(15, 30, 49, .08);
}

body .cpm-account-panel__identity {
  gap: 5px;
  padding: 12px 12px 13px;
  border-bottom: 1px solid var(--cpm-integration-border);
}

body .cpm-account-panel__identity strong {
  color: var(--cpm-integration-navy);
  font-size: 14px;
  font-weight: 800;
}

body .cpm-account-panel__identity > span {
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
}

/* Desktop account menu uses the same visual language and data as PSICOLE's
 * digital credential: navy header, official mark, status, matrícula, expiry
 * and the verification QR returned by /credential. */
body .cpm-account-mini-card {
  display: block;
  min-height: max-content;
  align-self: start;
  margin: 10px 2px 8px;
  overflow: hidden;
  border: 1px solid rgba(26, 46, 74, .14);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 30, 49, .1), 0 1px 2px rgba(15, 30, 49, .06);
}

body .cpm-account-mini-card[hidden] {
  display: none !important;
}

body .cpm-account-mini-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 43px;
  padding: 9px 11px;
  background: linear-gradient(135deg, #0e0620 0%, #180d42 35%, #1c1158 100%);
}

body .cpm-account-mini-card__header img {
  display: block;
  width: 116px;
  height: auto;
  max-height: 22px;
  object-fit: contain;
  object-position: left center;
  filter: brightness(0) invert(1);
  opacity: .96;
}

body .cpm-account-mini-card__header span {
  color: rgba(224, 213, 255, .86);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

body .cpm-account-mini-card__body {
  padding: 12px;
}

body .cpm-account-mini-card__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

body .cpm-account-mini-card__avatar {
  display: grid;
  width: 47px;
  height: 47px;
  flex: 0 0 47px;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(135deg, #4338ca 0%, #7c3aed 70%, #c026d3 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

body .cpm-account-mini-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body .cpm-mobile-account__avatar {
  position: relative;
  overflow: hidden;
  border-radius: 50%;
}

body .cpm-mobile-account__avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

body .cpm-account-mini-card__person {
  display: grid;
  min-width: 0;
  gap: 2px;
}

body .cpm-account-mini-card__person strong {
  overflow: hidden;
  color: #0b1120;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.16;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body .cpm-account-mini-card__person > span:last-child {
  color: #4338ca;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
}

body .cpm-account-mini-card__status {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid #6ee7b7;
  border-radius: 999px;
  background: #d1fae5;
  color: #047857;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

body .cpm-account-mini-card__status.is-inactive {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #64748b;
}

body .cpm-account-mini-card__status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

body .cpm-account-mini-card__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid #ece8f3;
}

body .cpm-account-mini-card__footer > div:first-child {
  display: grid;
  gap: 3px;
}

body .cpm-account-mini-card__footer > div:first-child span {
  color: #94a3b8;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

body .cpm-account-mini-card__footer > div:first-child strong {
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
}

body .cpm-account-mini-card__qr-wrap {
  flex: 0 0 auto;
  padding: 3px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(12, 7, 40, .1), 0 0 0 1px rgba(0, 0, 0, .05);
}

body .cpm-account-mini-card__qr-wrap[hidden] {
  display: none !important;
}

body .cpm-account-mini-card__qr-wrap img {
  display: block;
  width: 58px;
  height: 58px;
  image-rendering: pixelated;
}

/* This action is intentionally present only inside the mobile menu. */
body .cpm-mobile-session-link {
  display: none !important;
}

body .cpm-account-panel__status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

body .cpm-account-status-chip {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid rgba(5, 150, 105, .16);
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}

body .cpm-account-status-chip--muted {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

body .cpm-account-status-chip--warning {
  border-color: rgba(217, 119, 6, .2);
  background: #fff7ed;
  color: #b45309;
}

body .cpm-account-status-chip--inactive {
  border-color: #e2e8f0;
  background: #f1f5f9;
  color: #64748b;
}

body .cpm-account-panel__section-label {
  margin: 11px 11px 4px;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

body .cpm-account-panel__section-label--secondary {
  margin-top: 8px;
}

body .cpm-account-panel > a,
body .cpm-account-panel__logout {
  min-height: 42px;
  border-radius: 10px;
  font-size: 13px;
}

body .cpm-account-panel > a.cpm-account-panel__primary-link {
  border: 1px solid rgba(67, 56, 202, .12);
  background: #f7f5ff;
  color: var(--cpm-integration-purple);
  font-weight: 800;
}

body .cpm-account-panel > a.cpm-account-panel__primary-link:hover,
body .cpm-account-panel > a.cpm-account-panel__primary-link:focus-visible {
  border-color: rgba(67, 56, 202, .24);
  background: #f0ecff;
}

body .cpm-account-panel__status {
  margin: 4px 11px 1px;
}

/* Keep the approved compact header rhythm through the scrollbar-adjusted
 * medium desktop range. At 1180–1200px the layout viewport can lose 15–17px
 * to the vertical scrollbar, so the fee action must collapse before it can
 * create horizontal scrolling. */
@media (min-width: 981px) and (max-width: 1200px) {
  body .cpm-header__inner {
    gap: 14px !important;
  }

  body .cpm-header .cpm-nav {
    gap: 2px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  body .cpm-header .cpm-nav a {
    padding-inline: 9px !important;
  }

  body .cpm-header .cpm-actions {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    gap: 8px !important;
  }

  body .cpm-header .cpm-login-link {
    white-space: nowrap !important;
  }

  body .cpm-header .cpm-actions .cpm-button--primary {
    max-width: 44px !important;
    min-width: 44px !important;
    width: 44px !important;
    padding-inline: 0 !important;
    overflow: hidden !important;
    color: transparent !important;
    white-space: nowrap !important;
  }

  body .cpm-header .cpm-actions .cpm-button--primary svg {
    margin: 0 !important;
    color: #fff !important;
  }
}

@media (max-width: 700px) {
  :root {
    --cpm-integration-mobile-dock: calc(76px + env(safe-area-inset-bottom));
  }

  body .cpm-account-panel {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: calc(var(--cpm-integration-mobile-dock) + 12px);
    left: 12px;
    width: auto;
    max-height: min(72vh, 590px);
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 22px;
    transform-origin: bottom center;
    animation: cpm-account-sheet-in 160ms ease-out both;
  }

  body .cpm-account-panel[hidden] {
    display: none !important;
  }

  body.cpm-account-sheet-open .cpm-mobile-dock {
    pointer-events: none;
    opacity: .55;
  }

  body .cpm-account-panel__identity {
    padding: 15px 14px 14px;
  }

  body .cpm-header .cpm-nav .cpm-mobile-session-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-top: 8px;
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    color: var(--cpm-integration-purple);
    font-weight: 750;
  }

  body .cpm-header .cpm-nav .cpm-mobile-session-link[hidden] {
    display: none !important;
  }

  body .cpm-account-mini-card {
    margin-inline: 2px;
  }

  body .cpm-account-panel__section-label {
    margin-inline: 13px;
  }

  body .cpm-account-panel > a,
  body .cpm-account-panel__logout {
    min-height: 46px;
    padding-inline: 13px;
    font-size: 14px;
  }
}

/* V10600 — authenticated surface composition.
 * One viewport owns one floating surface. The account panel is a real,
 * scrollable sheet on phones and a bounded popover on desktop; it never
 * inherits the page's translucent layers or competes with the nav. */
body .cpm-account-panel {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  max-height: min(720px, calc(100dvh - 88px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: #fff;
}

body .cpm-account-mini-card__header {
  background: #1b1055;
}

body .cpm-account-mini-card__avatar {
  background: #54277f;
}

body .cpm-mobile-account {
  display: none;
}

body .cpm-mobile-account[hidden] {
  display: none !important;
}

@media (max-width: 700px) {
  :root {
    --cpm-integration-mobile-header: 73px;
  }

  html.cpm-account-sheet-open,
  body.cpm-account-sheet-open {
    overflow: hidden;
  }

  body.cpm-account-sheet-open::before {
    position: fixed;
    z-index: 3230;
    inset: 0;
    background: rgba(20, 12, 33, .22);
    content: "";
    pointer-events: auto;
  }

  html.cpm-account-sheet-open .cpm-header {
    z-index: 3240;
  }

  body .cpm-account-panel {
    position: fixed;
    z-index: 3250;
    top: calc(var(--cpm-integration-mobile-header) + 8px);
    right: 10px;
    bottom: calc(var(--cpm-integration-mobile-dock) + 8px);
    left: 10px;
    width: auto;
    max-height: none;
    min-height: 0;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(20, 12, 33, .24), 0 2px 12px rgba(20, 12, 33, .1);
    animation: cpm-account-sheet-in 160ms ease-out both;
  }

  body.cpm-account-sheet-open .cpm-mobile-dock {
    pointer-events: none;
    opacity: .48;
  }

  body .cpm-account-panel__identity {
    padding: 14px 13px 12px;
  }

  /* The hamburger is the public navigation; when a PSICOLE session is
   * active it also carries this compact personal section. The avatar still
   * opens the full credential sheet, but the two surfaces never overlap. */
  body .cpm-header .cpm-nav .cpm-mobile-account:not([hidden]) {
    display: grid !important;
    gap: 9px;
    margin: 8px 2px 2px;
    padding: 11px;
    border: 1px solid rgba(84, 39, 127, .14);
    border-radius: 13px;
    background: #fbf9fe;
  }

  body .cpm-mobile-account__identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
  }

  body .cpm-mobile-account__identity > div {
    display: grid;
    min-width: 0;
    gap: 2px;
  }

  body .cpm-mobile-account__identity strong,
  body .cpm-mobile-account__identity span:not(.cpm-account-avatar) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body .cpm-mobile-account__identity strong {
    color: #1a2e4a;
    font-size: 13px;
    font-weight: 800;
  }

  body .cpm-mobile-account__identity span:not(.cpm-account-avatar) {
    color: #6b7b91;
    font-size: 11px;
    font-weight: 650;
  }

  body .cpm-mobile-account__links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  body .cpm-mobile-account__links a,
  body .cpm-mobile-account__links button {
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 6px;
    padding: 8px 9px;
    border: 1px solid rgba(84, 39, 127, .11);
    border-radius: 9px;
    background: #fff;
    color: #54277f;
    font-size: 12px;
    font-weight: 800;
    font-family: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }

  body .cpm-mobile-account__links a span,
  body .cpm-mobile-account__links button span {
    flex: 0 0 auto;
    font-size: 14px;
  }

  body .cpm-mobile-account__links a:hover,
  body .cpm-mobile-account__links a:focus-visible,
  body .cpm-mobile-account__links button:hover,
  body .cpm-mobile-account__links button:focus-visible {
    border-color: rgba(84, 39, 127, .28);
    background: #f2ecfa;
  }

  body .cpm-mobile-account__links .cpm-mobile-account__logout {
    grid-column: 1 / -1;
    border-color: rgba(108, 62, 76, .16);
    color: #6c3e4c;
    background: #fff;
  }

  body .cpm-mobile-account__links .cpm-mobile-account__logout[disabled] {
    cursor: wait;
    opacity: .6;
  }

  body .cpm-account-mini-card {
    margin-top: 9px;
    margin-bottom: 8px;
  }

  body .cpm-account-mini-card__header {
    min-height: 40px;
    padding: 8px 10px;
  }

  body .cpm-account-mini-card__header img {
    width: 112px;
    max-height: 20px;
  }

  body .cpm-account-mini-card__body {
    padding: 11px;
  }

  body .cpm-account-mini-card__footer {
    margin-top: 10px;
    padding-top: 9px;
  }

  body .cpm-account-panel__section-label {
    margin-top: 10px;
  }

  body .cpm-account-panel > a,
  body .cpm-account-panel__logout {
    min-height: 44px;
  }

  /* Defensive mutual exclusion for cached markup while JS is settling. */
  html.cpm-account-sheet-open .cpm-header.is-menu-open .cpm-nav {
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@keyframes cpm-account-sheet-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  body .cpm-account-panel { animation: none; }
}

/* V10520: mobile navigation repair.
 * The session link carries the same inline icon used by the desktop header.
 * Give it an explicit box so an SVG without intrinsic dimensions can never
 * expand the menu into a giant black shape. Keep the sheet compact and safe
 * inside short phone viewports. */
body .cpm-header .cpm-nav .cpm-mobile-session-link svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  flex: 0 0 18px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

body .cpm-header .cpm-nav .cpm-mobile-session-link[hidden] {
  display: none !important;
}

@media (max-width: 700px) {
  body .cpm-header .cpm-nav {
    top: calc(100% + 8px) !important;
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
    max-height: min(560px, calc(100dvh - 92px)) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 8px !important;
    gap: 2px !important;
    border-radius: 18px !important;
    background: #fff !important;
    box-shadow: 0 20px 48px rgba(26, 20, 42, .18), 0 2px 8px rgba(26, 20, 42, .08) !important;
  }

  body .cpm-header .cpm-nav > a {
    min-height: 46px !important;
    padding: 11px 13px !important;
    border-radius: 11px !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
  }

  body .cpm-header .cpm-nav > a.cpm-mobile-session-link {
    min-height: 46px !important;
    margin-top: 6px !important;
    padding: 12px 13px !important;
    border: 1px solid rgba(84, 39, 127, .13) !important;
    border-radius: 12px !important;
    background: #f7f3fc !important;
    color: #54277f !important;
    font-weight: 800 !important;
  }

  body .cpm-header .cpm-nav > a.cpm-mobile-session-link:hover,
  body .cpm-header .cpm-nav > a.cpm-mobile-session-link:focus-visible {
    background: #efe8f9 !important;
  }
}

/* PAGOS quick access: two-option format (Cuota Colegiación / Cursos) */
body .cpm-ui26-quick__item--menu {
  position: relative;
}

body .cpm-ui26-quick__item--menu summary {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  cursor: pointer;
  list-style: none;
}

body .cpm-ui26-quick__item--menu summary::-webkit-details-marker {
  display: none;
}

body .cpm-ui26-quick__item--menu summary:focus-visible {
  outline: 2px solid var(--cpm-purple, #6d28d9);
  outline-offset: 2px;
  border-radius: 10px;
}

body .cpm-ui26-quick__chevron {
  margin-left: auto;
  font-size: 13px;
  line-height: 1;
  transition: transform .18s ease;
  opacity: .7;
}

body .cpm-ui26-quick__item--menu[open] .cpm-ui26-quick__chevron {
  transform: rotate(180deg);
}

body .cpm-ui26-quick__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  display: grid;
  gap: 4px;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(26, 46, 74, .14);
  border-radius: 12px;
  box-shadow: 0 18px 38px -14px rgba(15, 30, 49, .22), 0 1px 2px rgba(15, 30, 49, .06);
}

body .cpm-ui26-quick__menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

body .cpm-ui26-quick__menu a:hover,
body .cpm-ui26-quick__menu a:focus-visible {
  background: rgba(109, 40, 217, .08);
  color: #4c1d95;
}

/* Pagos service card: two CTAs in one row */
body .cpm-ui26-service__cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* Beneficios / contenido: iconos junto a enlaces de contacto */
body .cpm-content a[href^="tel:"]::before,
body .cpm-post-single__article a[href^="tel:"]::before {
  content: "📞";
  margin-right: .35em;
  font-size: .92em;
}

body .cpm-content a[href^="mailto:"]::before,
body .cpm-post-single__article a[href^="mailto:"]::before {
  content: "✉️";
  margin-right: .35em;
  font-size: .92em;
}

body .cpm-content a[href^="https://wa.me"]::before,
body .cpm-post-single__article a[href^="https://wa.me"]::before {
  content: "💬";
  margin-right: .35em;
  font-size: .92em;
}

body .cpm-content a[href^="https://maps"]::before,
body .cpm-post-single__article a[href^="https://maps"]::before {
  content: "📍";
  margin-right: .35em;
  font-size: .92em;
}
