/* Compass is isolated from page/plugin styles and inherits the BF theme tokens. */
.bf-compass {
  --compass-gap: 16px;
  position: fixed;
  inset-inline-end: max(var(--compass-gap), env(safe-area-inset-right));
  bottom: calc(max(var(--compass-gap), env(safe-area-inset-bottom)) + var(--compass-badge-offset, 0px));
  z-index: 30;
  width: min(360px, calc(100% - 2 * var(--compass-gap)));
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--bf-sidebar-heading, #303f4f);
  pointer-events: none;
}
.bf-compass [hidden], .bf-compass[hidden] { display: none !important; }
.bf-compass *, .bf-compass *::before, .bf-compass *::after { box-sizing: border-box; }
#bf-compass button, #bf-compass a {
  font: inherit;
  color: inherit;
  text-align: start;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.bf-compass button { cursor: pointer; }
.bf-compass button:focus-visible, .bf-compass a:focus-visible {
  outline: 3px solid var(--color-blue-close, #4e7aa7);
  outline-offset: 2px;
}
.bf-compass-launcher {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  min-height: 48px;
  margin-inline-start: auto;
  padding: 9px;
  border: 1px solid var(--bf-sidebar-active-border, #b6cbe0);
  border-radius: 50%;
  background: var(--bf-sidebar-card-bg, #fff);
  box-shadow: var(--bf-sidebar-card-shadow);
  font-weight: 600 !important;
  pointer-events: auto;
  transition: background-color 140ms ease, transform 140ms ease;
}
.bf-compass-launcher:hover { background: var(--bf-sidebar-active-bg, #e8f0f8); }
.bf-compass-launcher:active { transform: scale(.96); }
/* Keep a cached earlier launcher icon-only during the asset-first release. */
.bf-compass-launcher > span { display: none; }
.bf-compass-mark { flex: 0 0 auto; color: var(--color-blue-close, #4e7aa7); }
.bf-compass-panel {
  position: absolute;
  inset-inline: 0;
  bottom: 60px;
  display: flex;
  flex-direction: column;
  max-height: min(620px, calc(var(--compass-viewport-height, 100dvh) - 100px - var(--compass-top-clearance, 16px) - var(--compass-badge-offset, 0px)));
  overflow: hidden;
  border-radius: 20px;
  background: var(--bf-sidebar-card-bg, #fff);
  border: 1px solid var(--bf-sidebar-border, #dce5ed);
  box-shadow: 0 5px 12px rgb(20 44 72 / .10), 0 20px 45px rgb(20 44 72 / .15);
  pointer-events: auto;
}
.bf-compass-head {
  display: flex;
  flex-shrink: 0;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 12px 12px 18px;
  border-bottom: 1px solid var(--bf-sidebar-border);
}
#bf-compass .bf-compass-head h2 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.3; }
#bf-compass .bf-compass-head p { margin: 5px 0 0; font-size: 12px; color: var(--bf-sidebar-muted); }
.bf-compass-close {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
}
.bf-compass-close:hover, .bf-compass-back:hover { background: var(--bf-sidebar-active-bg); }
.bf-compass-content { padding: 8px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.bf-compass-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 58px;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  transition: background-color 140ms ease;
}
.bf-compass-task:hover, .bf-compass-resource:hover { background: var(--bf-sidebar-active-bg); }
.bf-compass-task > span { min-width: 0; }
.bf-compass-task-title { display: block; font-weight: 600; }
.bf-compass-task-description { display: block; margin-top: 2px; font-size: 12px; color: var(--bf-sidebar-muted); text-wrap: pretty; }
.bf-compass-task svg { flex-shrink: 0; color: var(--bf-sidebar-muted); }
.bf-compass-back {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 13px !important;
}
#bf-compass .bf-compass-branch h3 { margin: 12px 10px 8px; font-size: 16px; font-weight: 600; text-wrap: balance; }
.bf-compass-branch h3:focus { outline: none; }
#bf-compass .bf-compass-branch h4 { margin: 16px 10px 4px; font-size: 12px; font-weight: 600; color: var(--bf-sidebar-muted); }
.bf-compass-resource {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  overflow-wrap: anywhere;
}
.bf-compass-resource span, .bf-compass-foot a span { flex-shrink: 0; color: var(--bf-sidebar-muted); }
#bf-compass .bf-compass-note { margin: 12px 10px; font-size: 12px; text-wrap: pretty; }
.bf-compass-foot {
  flex-shrink: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--bf-sidebar-border);
  background: var(--bf-sidebar-control-bg, #f5f8fc);
}
#bf-compass .bf-compass-foot a { display: block; padding: 8px 4px; min-height: 40px; font-size: 12px; text-wrap: pretty; }
#bf-compass .bf-compass-foot a:hover { text-decoration: underline; }
body.bf-menu-open .bf-compass, .bf-compass[data-suspended="true"] { visibility: hidden; }
@media (max-width: 639px) {
  .bf-compass { --compass-gap: 12px; }
  .bf-compass-panel { max-height: calc(var(--compass-viewport-height, 100dvh) - 108px - var(--compass-top-clearance, 120px) - var(--compass-badge-offset, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .bf-compass button { transition: none; }
  .bf-compass-launcher:active { transform: none; }
}
@media print { .bf-compass { display: none !important; } }
