/* One quiet, readable workspace panel for planet details and AI. */
:root { --af-inspector-width: clamp(330px, 28vw, 400px); }
body.af-inspector-modal :is(.mobile-bottom-nav, .agent-chat-launcher) { visibility: hidden; }

/* Keep the fullscreen chart inside its grid row above the planet list. */
.af-refresh .cosmogram-main-card:is(:fullscreen, .is-fullscreen-fallback) > .large-cosmogram-stage {
  height: 100% !important;
}
.af-refresh .cosmogram-main-card:is(:fullscreen, .is-fullscreen-fallback) .cosmogram-wrap {
  grid-template-rows: minmax(0, 1fr);
}
.af-refresh .cosmogram-main-card:is(:fullscreen, .is-fullscreen-fallback) .cosmogram-svg {
  min-height: 0;
  aspect-ratio: auto;
}

.af-agent-launcher.agent-chat-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: auto !important;
  height: 46px !important;
  min-height: 46px;
  padding: 0 17px;
  right: 24px;
  bottom: 22px;
  border: 1px solid #a493df66;
  border-radius: 12px;
  color: #eee9ff;
  background: #26223b;
  box-shadow: 0 6px 20px #0003;
  font-family: inherit;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.2;
  animation: none;
  transform: none;
  filter: none;
}
.af-agent-launcher.agent-chat-launcher::before,
.af-agent-launcher.agent-chat-launcher::after { display: none; }
.af-agent-launcher.agent-chat-launcher:hover { background: #312943; box-shadow: 0 6px 24px #0004; transform: translateY(-1px); }
.af-agent-launcher > svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.af-agent-launcher > span { white-space: nowrap; }
.af-agent-launcher:focus-visible,
.af-inspector-chat:focus-visible,
.af-return-to-planet:focus-visible { outline: 2px solid #bdadff; outline-offset: 3px; }

.mobile-inspector-sheet .inspector-head { align-items: start; gap: 13px; }
.mobile-inspector-sheet .inspector-head h3 { font-size: 24px; letter-spacing: -.02em; }
.mobile-inspector-sheet .inspector-head p,
.mobile-inspector-sheet .route-note,
.mobile-inspector-sheet .inspector-reference-list dd { color: #b5bad0; font-size: 13px !important; line-height: 1.6; }
.mobile-inspector-sheet .inspector-kicker { font-size: 10px; line-height: 1.5; letter-spacing: .06em; color: #9694ad; }
.mobile-inspector-sheet .inspector-stats { gap: 0 18px; }
.mobile-inspector-sheet .inspector-stats > div { padding: 13px 0; background: none; border: 0; border-bottom: 1px solid #a99bc31a; border-radius: 0; }
.mobile-inspector-sheet .inspector-stats span,
.mobile-inspector-sheet .inspector-stats small { font-size: 12px; color: #9b9eb4; }
.mobile-inspector-sheet .inspector-stats strong { margin-top: 6px; font-size: 14px !important; font-weight: 550; }
.mobile-inspector-sheet .inspector-section { padding-top: 18px; margin-top: 18px; border-top: 1px solid #a99bc31a; }
.mobile-inspector-sheet .section-mini-title { display: flex; font-size: 13px; }
.mobile-inspector-sheet .section-mini-title small { font-size: 11px; }
.mobile-inspector-sheet .route-chip { font-size: 12px; min-height: 36px; border-radius: 8px; }
.mobile-inspector-sheet .related-list > button,
.mobile-inspector-sheet .aspect-mini-list > button { background: transparent; border: 0; border-radius: 7px; min-height: 42px; }
.mobile-inspector-sheet :is(.related-list, .aspect-mini-list) > button { grid-template-columns: 27px minmax(0, 1fr) auto; }
.mobile-inspector-sheet :is(.related-list, .aspect-mini-list) > button > span { grid-column: 1; grid-row: 1 / 3; }
.mobile-inspector-sheet :is(.related-list, .aspect-mini-list) > button > strong { grid-column: 2; grid-row: 1; }
.mobile-inspector-sheet :is(.related-list, .aspect-mini-list) > button > small { grid-column: 2; grid-row: 2; }
.mobile-inspector-sheet :is(.related-list, .aspect-mini-list) > button > i { grid-column: 3; grid-row: 1 / 3; }
.mobile-inspector-sheet .related-list > button:hover,
.mobile-inspector-sheet .aspect-mini-list > button:hover { background: #ffffff07; }
.mobile-inspector-sheet .related-list strong,
.mobile-inspector-sheet .aspect-mini-list strong { font-size: 13px !important; }
.mobile-inspector-sheet .related-list small,
.mobile-inspector-sheet .aspect-mini-list small,
.mobile-inspector-sheet .aspect-mini-list i { font-size: 11px !important; color: #a1a5bb; }
.mobile-inspector-sheet .inspector-reference-list > div { padding: 9px 0; border: 0; border-radius: 0; background: none; }
.mobile-inspector-sheet .inspector-reference-list dt { font-size: 12px; color: #d1ccdf; }
.mobile-inspector-sheet .inspector-disclaimer { font-size: 11px; color: #858b9e; line-height: 1.5; }
.mobile-inspector-sheet .inspector-tags { gap: 6px; flex-wrap: wrap; }
.mobile-inspector-sheet .inspector-tags span { border: 0; background: #aaa0ca0b; color: #a5a7ba; font-size: 11px; }
.mobile-inspector-sheet .af-inspector-explain { width: 100%; min-height: 44px; padding: 11px 12px; font-size: 13px !important; white-space: normal; line-height: 1.5; color: #e9e3ff; background: #9b81ed18; border: 1px solid #a68ce83d; border-radius: 9px; }
.af-inspector-chat { display: block; width: 100%; margin-top: 8px; min-height: 40px; background: transparent; color: #b9a6ef; border: 0; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; }
.af-inspector-chat:hover { background: #a99be00d; }
#mobile-inspector-content .af-inspector-chat { background: transparent !important; box-shadow: none; border: 0; }
#mobile-inspector-content .af-inspector-chat:hover { background: #a99be00d !important; }
.af-inspector-reference > summary { color: #b8b0d0; font-size: 13px; cursor: pointer; }
.af-inspector-reference[open] > summary { margin-bottom: 12px; }
.af-inspector-reference > summary:focus-visible { outline: 2px solid #bdadff; outline-offset: 5px; border-radius: 2px; }
.af-return-to-planet { padding: 8px; background: transparent; border: 0; color: #c0b2e9; font: inherit; font-size: 12px; border-radius: 7px; white-space: nowrap; cursor: pointer; }
.af-return-to-planet[hidden] { display: none; }

@media (min-width: 1100px) {
  body.af-workspace-panel-open:not([data-view="dashboard"]) .app-main { padding-right: calc(var(--af-inspector-width) + 38px) !important; }
  body.af-docked-inspector.af-inspector-open:not(.modal-open):not(.calculation-open) { overflow: auto; }
  body.af-docked-inspector #mobile-inspector-layer {
    inset: calc(var(--header-h, 70px) + 18px) 18px 18px auto;
    width: var(--af-inspector-width);
    display: block !important;
    padding: 0;
    pointer-events: none;
    place-items: stretch !important;
  }
  body.af-docked-inspector #mobile-inspector-layer[hidden] { display: none !important; }
  body.af-docked-inspector #mobile-inspector-layer > .modal-backdrop { display: none; }
  body.af-docked-inspector #mobile-inspector-content {
    width: 100%;
    height: 100%;
    max-height: none;
    padding: 0;
    border: 1px solid #b9a8d924;
    border-radius: 16px;
    background: #141520;
    box-shadow: 0 12px 30px #0002;
    pointer-events: auto;
    overscroll-behavior: contain;
    transform: translateX(12px);
  }
  body.af-docked-inspector #mobile-inspector-layer.open #mobile-inspector-content { transform: none; }
  body.af-docked-inspector #mobile-inspector-content .sheet-handle { display: none; }
  body.af-docked-inspector #mobile-inspector-content > .planet-inspector { padding: 22px 20px; }
  body.af-docked-inspector #mobile-inspector-content .inspector-planet { width: 44px; height: 44px; flex-shrink: 0; }
  body.af-docked-inspector #mobile-inspector-content .inspector-head { position: relative; padding-right: 25px; }
  body.af-docked-inspector #mobile-inspector-content .inspector-close { position: absolute; top: -9px; right: -8px; min-width: 36px; min-height: 36px; border: 0; background: none; color: #a9a6bf; }
  body.af-workspace-panel-open .cosmogram-side-column > .planet-inspector { display: none; }
  body.af-workspace-panel-open .cosmogram-page-grid { grid-template-columns: minmax(0, 1fr); }
  body.af-workspace-panel-open .cosmogram-side-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  body.af-docked-inspector .agent-popup-panel {
    inset: calc(var(--header-h, 70px) + 18px) 18px 18px auto;
    width: var(--af-inspector-width);
    min-height: 0;
    border: 1px solid #b9a8d924;
    border-radius: 16px;
    background: #141520;
    box-shadow: 0 12px 30px #0002;
    backdrop-filter: none;
  }
  body.af-docked-inspector .agent-popup-panel::before,
  body.af-docked-inspector .agent-popup-header::after,
  body.af-docked-inspector .agent-popup-avatar { display: none; }
  body.af-docked-inspector .agent-popup-header { grid-template-columns: minmax(0, 1fr) auto; min-height: 78px; padding: 15px; background: transparent; border-color: #a99bc31a; }
  body.af-docked-inspector .agent-popup-heading small { display: none; }
  body.af-docked-inspector .agent-popup-heading strong { font-size: 17px; }
  body.af-docked-inspector .agent-popup-heading em { margin-top: 5px; font-size: 11px; color: #a4a0b8; }
  body.af-docked-inspector .agent-popup-actions { gap: 1px; }
  body.af-docked-inspector .agent-popup-close { width: 32px; height: 36px; border: 0; background: transparent; }
  body.af-inspector-open .af-agent-launcher { right: calc(var(--af-inspector-width) + 38px); }
  body.af-inspector-open #agent-popup-layer:not(.is-open) { visibility: hidden; }
}

@media (max-width: 767px) {
  body.af-refresh .cosmogram-main-card:is(:fullscreen, .is-fullscreen-fallback) {
    grid-template-rows: max-content max-content minmax(320px, 1fr) max-content max-content !important;
    overflow-y: auto !important;
  }
  .af-agent-launcher.agent-chat-launcher { right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); height: 42px !important; min-height: 42px; padding: 0 13px; font-size: 13px; }
  .mobile-inspector-sheet .inspector-head h3 { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .af-agent-launcher.agent-chat-launcher,
  body.af-docked-inspector #mobile-inspector-content { transition: none; transform: none; }
}
