/* Shared AI4OPS scroll-progress control and main-sidebar shortcut. */
.page-fab {
  position: fixed;
  z-index: 1040;
  right: max(1.35rem, env(safe-area-inset-right));
  bottom: max(calc(var(--page-fab-obstruction, 0px) + 1.35rem), env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: .6rem;
  pointer-events: none;
}
.page-fab button[hidden] { display: none !important; }
.page-fab button {
  flex: none;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .38);
  transition: filter 180ms ease;
}
.page-fab .page-fab-top {
  --scroll-progress: 0deg;
  position: relative;
  display: grid;
  place-items: center;
  width: 3.15rem;
  height: 3.15rem;
  border: 0;
  color: #f8dd86;
  background: conic-gradient(#62c66e var(--scroll-progress), #286b3c 0);
}
.page-fab .page-fab-top::before {
  content: "";
  position: absolute;
  inset: .19rem;
  border-radius: inherit;
  background: linear-gradient(145deg, #152647, #080f22);
}
.page-fab i {
  position: relative;
  z-index: 1;
  line-height: 1;
  background: none;
  -webkit-text-fill-color: currentColor;
}
.page-fab-brand {
  position: relative;
  z-index: 1;
  width: calc(100% - .5rem);
  height: calc(100% - .5rem);
  overflow: hidden;
  border-radius: 50%;
  background: #020f2b;
}
.page-fab-brand img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Trim only the existing white margin; retain the original circular logo. */
  transform: scale(1.3);
}
.page-fab .fa-arrow-up {
  position: absolute;
  right: .18rem;
  bottom: .18rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  color: #9bdb83;
  background: #080f22;
  font-size: .64rem;
}
.page-fab .page-fab-sidebar {
  display: grid;
  place-items: center;
  width: 2.85rem;
  height: 2.85rem;
  border: 1px solid rgba(242, 193, 78, .6);
  color: #f8dd86;
  background: linear-gradient(145deg, #152647, #080f22);
  font-size: 1.1rem;
}
.page-fab button:hover { filter: brightness(1.18); }
.page-fab .page-fab-top { touch-action: none; user-select: none; cursor: grab; }
.page-fab-brand img { -webkit-user-drag: none; pointer-events: none; }
.page-fab.is-dragging .page-fab-top { cursor: grabbing; }
.page-fab button:focus-visible { outline: 3px solid #75cfff; outline-offset: 3px; }
.page-fab-menu[hidden] { display: none !important; }
.page-fab #pageFabMenu { background: #ffffff; color: #182134; width: min(280px, calc(100vw - 32px)); padding: 7px; isolation: isolate; overscroll-behavior: contain; scrollbar-width: thin; }
body.theme-dark .page-fab #pageFabMenu { background: #172137; color: #eef2fa; }
body:has(#pageFabTop[aria-expanded="true"]) .page-scroll-controls { visibility: hidden; }
.page-fab-menu { position: absolute; right: 0; bottom: calc(100% + 12px); width: min(310px, calc(100vw - 32px)); max-height: min(70vh, 540px); overflow-y: auto; padding: 10px; border: 1px solid var(--border, #ccd5e4); border-radius: 18px; background: var(--panel, #fff); color: var(--text, #182134); box-shadow: 0 14px 40px rgba(10, 20, 40, .22); pointer-events: auto; }
.page-fab-menu-heading { padding: 4px 8px 6px; font-size: .68rem; font-weight: 700; color: var(--muted, #667085); text-transform: uppercase; letter-spacing: .05em; }
.page-fab .page-fab-link, .page-fab-menu button { display: flex; align-items: center; gap: 7px; width: 100%; height: auto; min-height: 30px; padding: 5px 7px; border: 0; border-radius: 8px; background: transparent; color: inherit; box-shadow: none; font-size: .75rem; line-height: 1.3; text-decoration: none; text-align: left; }
.page-fab-menu .page-fab-telegram img { width: 28px; height: 28px; }
@media (pointer: coarse) { .page-fab-menu :is(a, button) { min-height: 44px; } }
.page-fab-link > i, .page-fab-link > svg { width: 20px; flex-shrink: 0; color: #59ae6b; }
.page-fab-telegram img { border-radius: 50%; }
.page-fab-link small { display: block; color: var(--muted, #667085); margin-top: 2px; }
.page-fab .page-fab-telegram { margin-bottom: 6px; background: rgba(83, 168, 224, .1); }
.page-fab-link:hover, .page-fab-menu button:hover { background: rgba(90, 160, 120, .12); }
.page-fab-link:focus-visible { outline: 2px solid #62c66e; outline-offset: -2px; }
.page-fab-toggle-mark { position: absolute; right: 0; bottom: 0; z-index: 2; background: #142c22; color: #a5edac; border-radius: 50%; width: 18px; height: 18px; line-height: 18px; font-size: 16px; }
.page-fab-top[aria-expanded="true"] .page-fab-toggle-mark { transform: rotate(45deg); }
/* Keep page navigation behind modal experiences and the mobile drawer. */
body.modal-open .page-fab,
body.sidebar-open .page-fab,
body:has(#voicePopup:not(.hidden)) .page-fab { visibility: hidden; }
@media (max-width: 576px) {
  .page-fab {
    right: max(.9rem, env(safe-area-inset-right));
    bottom: max(calc(var(--page-fab-obstruction, 0px) + .9rem), env(safe-area-inset-bottom));
  }
  .page-fab .page-fab-top { width: 2.85rem; height: 2.85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .page-fab button { transition: none; }
}
