/* v169: keep the existing three-column design while making the AI composer
   reachable on short desktop screens and mobile devices. */

.v169-ai-access .v169-ai-dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1180;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #12304a;
  color: #fff;
  box-shadow: 0 12px 30px rgba(18, 48, 74, .24);
  font: 700 13px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease, opacity .16s ease;
}

.v169-ai-access .v169-ai-dock:hover {
  transform: translateY(-2px);
  background: #174669;
}

.v169-ai-access .v169-ai-dock:active {
  transform: scale(.97);
}

.v169-ai-access .v169-ai-dock[hidden] {
  display: none !important;
}

.v169-ai-access .v169-ai-dock svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.v169-ai-access .v169-ai-close {
  display: none;
}

@media (max-width: 980px) {
  .v169-ai-access .v169-ai-dock {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .v169-ai-access.mobile-ai-open {
    overflow: hidden;
  }

  .v169-ai-access.mobile-ai-open .ai-panel {
    position: fixed !important;
    inset: 64px 10px max(10px, env(safe-area-inset-bottom)) 10px !important;
    z-index: 1210 !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 70px rgba(17, 35, 52, .34) !important;
    overflow: hidden !important;
    grid-template-rows: auto minmax(130px, 1fr) auto auto auto auto auto !important;
  }

  .v169-ai-access.mobile-ai-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(12, 25, 36, .42);
    backdrop-filter: blur(2px);
  }

  .v169-ai-access.mobile-ai-open .v169-ai-dock {
    display: none !important;
  }

  .v169-ai-access .v169-ai-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #d8e1e8;
    border-radius: 50%;
    background: #fff;
    color: #263746;
    font: 700 20px/1 system-ui, sans-serif;
    cursor: pointer;
  }

  .v169-ai-access.mobile-ai-open .v169-ai-close {
    display: grid;
    place-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .v169-ai-access .v169-ai-dock {
    transition: none;
  }
}
