/* CrewFill Agency read-only assistant */

#assistant-section {
  min-height: calc(100vh - 130px);
}

.cf-ai-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 150px);
  overflow: hidden;
  background: var(--bg-card, #ffffff);
  border: 1.5px solid var(--border, #dce4ef);
  border-radius: 20px;
  box-shadow: var(--shadow-sm, 0 8px 28px rgba(15, 31, 61, 0.08));
}

.cf-ai-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  background: #f5f7fb;
  border-right: 1px solid var(--border, #dce4ef);
}

.cf-ai-new-chat {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  background: linear-gradient(135deg, #e9f4ff, #f5efff);
  border: 1px solid #d6def4;
  border-radius: 12px;
  color: var(--text, #0f1f3d);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.cf-ai-new-chat:hover {
  transform: translateY(-1px);
  border-color: var(--blue, #168dcc);
  box-shadow: 0 8px 18px rgba(22, 141, 204, 0.12);
}

.cf-ai-rail-heading {
  margin: 22px 4px 9px;
  color: var(--text-dim, #8b99ae);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cf-ai-rail-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cf-ai-rail-item {
  width: 100%;
  padding: 10px 11px;
  overflow: hidden;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-muted, #5f708b);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.cf-ai-rail-item:hover,
.cf-ai-rail-item.active {
  background: #ffffff;
  border-color: var(--border, #dce4ef);
  color: var(--text, #0f1f3d);
}

.cf-ai-rail-empty {
  padding: 11px 4px;
  color: var(--text-dim, #8b99ae);
  font-size: 11px;
  line-height: 1.55;
}

.cf-ai-privacy-note {
  margin-top: auto;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border, #dce4ef);
  border-radius: 12px;
  color: var(--text-muted, #5f708b);
  font-size: 10px;
  line-height: 1.55;
}

.cf-ai-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100vh - 150px);
  background:
    radial-gradient(circle at 92% 2%, rgba(22, 141, 204, 0.08), transparent 26%),
    #ffffff;
}

.cf-ai-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border, #dce4ef);
}

.cf-ai-title-wrap {
  min-width: 0;
}

.cf-ai-title {
  color: var(--text, #0f1f3d);
  font-size: 18px;
  font-weight: 800;
}

.cf-ai-subtitle {
  margin-top: 3px;
  color: var(--text-muted, #5f708b);
  font-size: 11px;
}

.cf-ai-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cf-ai-read-only {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  background: #edf9f4;
  border: 1px solid #bce9d6;
  border-radius: 999px;
  color: #087a54;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.cf-ai-read-only::before {
  width: 7px;
  height: 7px;
  background: #18b77d;
  border-radius: 50%;
  content: "";
}

.cf-ai-insights-control {
  position: relative;
}

.cf-ai-insights-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 11px;
  background: #ffffff;
  border: 1px solid var(--border, #dce4ef);
  border-radius: 10px;
  color: var(--text, #0f1f3d);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.cf-ai-insights-button:hover {
  border-color: var(--blue, #168dcc);
}

.cf-ai-insights-dot {
  width: 8px;
  height: 8px;
  background: var(--text-dim, #8b99ae);
  border-radius: 50%;
}

.cf-ai-insights-button.enabled .cf-ai-insights-dot {
  background: #18b77d;
  box-shadow: 0 0 0 4px rgba(24, 183, 125, 0.12);
}

.cf-ai-insights-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 25;
  display: none;
  width: 255px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--border, #dce4ef);
  border-radius: 13px;
  box-shadow: 0 18px 45px rgba(15, 31, 61, 0.16);
}

.cf-ai-insights-menu.open {
  display: block;
}

.cf-ai-insights-option {
  display: block;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--text, #0f1f3d);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cf-ai-insights-option:hover,
.cf-ai-insights-option.active {
  background: var(--blue-light, #eef7fd);
}

.cf-ai-insights-option strong {
  display: block;
  font-size: 11px;
}

.cf-ai-insights-option span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted, #5f708b);
  font-size: 9px;
  line-height: 1.45;
}

.cf-ai-status {
  display: none;
  margin: 12px 20px 0;
  padding: 10px 12px;
  border: 1px solid #f1d39d;
  border-radius: 10px;
  background: #fff9ec;
  color: #8a5a00;
  font-size: 11px;
  line-height: 1.5;
}

.cf-ai-status.show {
  display: block;
}

.cf-ai-status.error {
  background: #fff1f1;
  border-color: #f1c4c4;
  color: #a52d2d;
}

.cf-ai-transcript {
  flex: 1;
  min-height: 0;
  padding: 28px max(22px, 8vw) 150px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.cf-ai-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 470px;
  text-align: center;
}

.cf-ai-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, var(--blue, #168dcc), #6b55e8);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(22, 141, 204, 0.2);
  color: #ffffff;
  font-size: 25px;
  font-weight: 800;
}

.cf-ai-greeting {
  color: var(--text, #0f1f3d);
  font-size: clamp(21px, 3vw, 29px);
  font-weight: 800;
}

.cf-ai-question {
  margin-top: 7px;
  color: var(--text-muted, #5f708b);
  font-size: 15px;
}

.cf-ai-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 680px;
  margin-top: 28px;
}

.cf-ai-quick-prompt {
  padding: 9px 14px;
  background: #ffffff;
  border: 1px solid var(--border, #dce4ef);
  border-radius: 999px;
  color: var(--text, #0f1f3d);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.cf-ai-quick-prompt:hover {
  transform: translateY(-1px);
  background: var(--blue-light, #eef7fd);
  border-color: var(--blue, #168dcc);
}

.cf-ai-message {
  display: flex;
  width: 100%;
  margin-bottom: 18px;
}

.cf-ai-message.user {
  justify-content: flex-end;
}

.cf-ai-bubble {
  max-width: min(760px, 86%);
  padding: 13px 15px;
  border-radius: 15px;
  color: var(--text, #0f1f3d);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.cf-ai-message.user .cf-ai-bubble {
  background: var(--blue, #168dcc);
  border-bottom-right-radius: 5px;
  color: #ffffff;
}

.cf-ai-message.assistant .cf-ai-bubble {
  background: #f5f7fb;
  border: 1px solid var(--border, #dce4ef);
  border-bottom-left-radius: 5px;
}

.cf-ai-message.refusal .cf-ai-bubble {
  background: #fff8ec;
  border-color: #f1d39d;
  color: #775000;
}

.cf-ai-bullets {
  margin: 10px 0 0;
  padding-left: 18px;
}

.cf-ai-bullets li + li {
  margin-top: 6px;
}

.cf-ai-thinking {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cf-ai-thinking span {
  width: 6px;
  height: 6px;
  background: var(--text-dim, #8b99ae);
  border-radius: 50%;
  animation: cf-ai-thinking 1.15s infinite ease-in-out;
}

.cf-ai-thinking span:nth-child(2) {
  animation-delay: 0.14s;
}

.cf-ai-thinking span:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes cf-ai-thinking {
  0%,
  70%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  35% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.cf-ai-chart {
  max-width: 760px;
  margin: 12px 0 20px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--border, #dce4ef);
  border-radius: 15px;
}

.cf-ai-chart-title {
  margin-bottom: 15px;
  color: var(--text, #0f1f3d);
  font-size: 13px;
  font-weight: 800;
}

.cf-ai-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 190px;
  padding-top: 12px;
}

.cf-ai-bar-column {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  min-width: 38px;
}

.cf-ai-bar-value {
  margin-bottom: 6px;
  color: var(--text-muted, #5f708b);
  font-size: 9px;
  font-weight: 800;
}

.cf-ai-bar {
  width: min(42px, 76%);
  min-height: 3px;
  background: linear-gradient(180deg, #1ea8df, #4c6fdc);
  border-radius: 7px 7px 3px 3px;
}

.cf-ai-bar-label {
  width: 100%;
  margin-top: 7px;
  overflow: hidden;
  color: var(--text-muted, #5f708b);
  font-size: 8px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cf-ai-references {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.cf-ai-reference {
  padding: 7px 9px;
  background: #ffffff;
  border: 1px solid var(--border, #dce4ef);
  border-radius: 8px;
  color: var(--blue, #168dcc);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.cf-ai-reference:hover {
  background: var(--blue-light, #eef7fd);
  border-color: var(--blue, #168dcc);
}

.cf-ai-composer-wrap {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 22px max(22px, 8vw) 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0),
    #ffffff 30%
  );
}

.cf-ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 900px;
  margin: 0 auto;
  padding: 9px 9px 9px 15px;
  background: #ffffff;
  border: 1.5px solid var(--blue, #168dcc);
  border-radius: 17px;
  box-shadow: 0 12px 35px rgba(15, 31, 61, 0.13);
}

.cf-ai-input {
  flex: 1;
  min-height: 42px;
  max-height: 130px;
  padding: 10px 0;
  resize: none;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text, #0f1f3d);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
}

.cf-ai-input::placeholder {
  color: var(--text-dim, #8b99ae);
}

.cf-ai-send {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--blue, #168dcc);
  border: 0;
  border-radius: 13px;
  color: #ffffff;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.cf-ai-send:hover {
  transform: translateY(-1px);
}

.cf-ai-send:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.cf-ai-disclaimer {
  margin-top: 8px;
  color: var(--text-dim, #8b99ae);
  font-size: 9px;
  text-align: center;
}

.cf-ai-mobile-rail-toggle {
  display: none;
}

@media (max-width: 900px) {
  #assistant-section {
    min-height: calc(100dvh - 100px);
  }

  .cf-ai-shell {
    display: block;
    min-height: calc(100dvh - 110px);
    border-radius: 15px;
  }

  .cf-ai-rail {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(290px, 86vw);
    transform: translateX(-105%);
    box-shadow: 18px 0 45px rgba(15, 31, 61, 0.2);
    transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .cf-ai-shell.rail-open .cf-ai-rail {
    transform: translateX(0);
  }

  .cf-ai-main {
    min-height: calc(100dvh - 110px);
  }

  .cf-ai-mobile-rail-toggle {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    background: #ffffff;
    border: 1px solid var(--border, #dce4ef);
    border-radius: 10px;
    color: var(--text, #0f1f3d);
    font: inherit;
    cursor: pointer;
  }

  .cf-ai-transcript {
    padding: 24px 18px 145px;
  }

  .cf-ai-composer-wrap {
    padding-right: 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    padding-left: 14px;
  }
}

@media (max-width: 600px) {
  .cf-ai-topbar {
    align-items: flex-start;
    padding: 12px;
  }

  .cf-ai-title {
    font-size: 15px;
  }

  .cf-ai-subtitle {
    display: none;
  }

  .cf-ai-top-actions {
    gap: 6px;
  }

  .cf-ai-read-only {
    padding: 5px 8px;
    font-size: 8px;
  }

  .cf-ai-insights-button {
    max-width: 130px;
    padding: 6px 8px;
    font-size: 9px;
  }

  .cf-ai-insights-menu {
    position: fixed;
    top: 78px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .cf-ai-empty {
    min-height: 380px;
  }

  .cf-ai-mark {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    font-size: 21px;
  }

  .cf-ai-question {
    font-size: 13px;
  }

  .cf-ai-bubble {
    max-width: 94%;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cf-ai-new-chat,
  .cf-ai-rail-item,
  .cf-ai-quick-prompt,
  .cf-ai-send,
  .cf-ai-rail {
    transition: none;
  }

  .cf-ai-thinking span {
    animation: none;
  }

  .cf-ai-transcript {
    scroll-behavior: auto;
  }
}
/* Assistant navigation neon ring */
.cf-ai-nav-btn {
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.cf-ai-nav-btn::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 15px;
  padding: 2px;
  background: linear-gradient(
    120deg,
    #22d3ee,
    #4f7cff,
    #9b5cff,
    #22d3ee
  );
  background-size: 300% 300%;
  pointer-events: none;
  opacity: 0.7;
  filter: drop-shadow(0 0 5px rgba(79, 124, 255, 0.65));

  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;

  animation:
    cfAiNeonOrbit 5s linear infinite,
    cfAiNeonBreath 2.8s ease-in-out infinite;
}

.cf-ai-nav-btn:hover::after,
.cf-ai-nav-btn.active::after,
.cf-ai-nav-btn[aria-selected="true"]::after {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(117, 92, 255, 0.9));
  animation: cfAiNeonOrbit 5s linear infinite;
}

@keyframes cfAiNeonOrbit {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 300% 50%;
  }
}

@keyframes cfAiNeonBreath {
  0%,
  100% {
    opacity: 0.58;
    filter: drop-shadow(0 0 4px rgba(79, 124, 255, 0.5));
  }

  50% {
    opacity: 0.88;
    filter: drop-shadow(0 0 8px rgba(155, 92, 255, 0.78));
  }
}

@media (prefers-reduced-motion: reduce) {
  .cf-ai-nav-btn::after {
    animation: none;
    opacity: 0.78;
  }
}


/*
 * Allowlisted Assistant navigation actions v1.
 */

.cf-ai-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cf-ai-navigation-button {
  min-height: 36px;
  padding: 8px 12px;
  background: #edf5ff;
  border: 1px solid #bdd6ff;
  border-radius: 10px;
  color: #1758b8;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.cf-ai-navigation-button:hover,
.cf-ai-navigation-button:focus-visible {
  background: #deebff;
  border-color: #73a5f7;
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  .cf-ai-navigation {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cf-ai-navigation-button {
    width: 100%;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cf-ai-navigation-button {
    transition: none;
  }
}


/*
 * Persistent Agency Assistant drawer v1.
 *
 * Desktop preserves access to the active workspace. Mobile promotes
 * the same mounted conversation to a full-screen panel.
 */

#assistant-section.cf-ai-drawer {
  position: fixed;
  z-index: 1400;
  top: 76px;
  right: 16px;
  bottom: 16px;
  width: min(460px, calc(100vw - 32px));
  min-height: 0;
  overflow: hidden;
  visibility: hidden;
  background: #ffffff;
  border: 1px solid var(--border, #dce4ef);
  border-radius: 20px;
  box-shadow:
    0 28px 80px rgba(15, 31, 61, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 40px));
  transition:
    transform 0.24s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.2s ease,
    visibility 0.2s ease;
}

#assistant-section.cf-ai-drawer.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.cf-ai-drawer .cf-ai-shell {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.cf-ai-drawer .cf-ai-main {
  height: 100%;
  min-height: 0;
}

.cf-ai-drawer .cf-ai-rail {
  position: absolute;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(300px, 86%);
  transform: translateX(-105%);
  box-shadow:
    18px 0 45px rgba(15, 31, 61, 0.2);
  transition:
    transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}

.cf-ai-drawer
.cf-ai-shell.rail-open
.cf-ai-rail {
  transform: translateX(0);
}

.cf-ai-drawer
.cf-ai-mobile-rail-toggle {
  display: grid;
}

.cf-ai-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: #ffffff;
  border: 1px solid var(--border, #dce4ef);
  border-radius: 10px;
  color: var(--text-muted, #5f708b);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.cf-ai-close:hover,
.cf-ai-close:focus-visible {
  border-color: var(--blue, #168dcc);
  color: var(--text, #0f1f3d);
}

.cf-ai-launcher {
  position: fixed;
  z-index: 1350;
  right: 22px;
  bottom: 22px;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  background:
    linear-gradient(
      135deg,
      #2f76f6,
      #7558e8
    );
  border: 0;
  border-radius: 18px;
  box-shadow:
    0 16px 38px rgba(47, 118, 246, 0.3);
  color: #ffffff;
  font: inherit;
  font-size: 22px;
  cursor: pointer;
  opacity: 1;
  transform: translateY(0);
  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    box-shadow 0.18s ease;
}

.cf-ai-launcher:hover,
.cf-ai-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 20px 44px rgba(47, 118, 246, 0.38);
}

.cf-ai-drawer-open
.cf-ai-launcher {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.cf-ai-nav-btn.is-open {
  background: rgba(47, 118, 246, 0.1);
  border-color: rgba(47, 118, 246, 0.4);
}

@media (max-width: 767px) {
  body.cf-ai-drawer-open {
    overflow: hidden;
  }

  #assistant-section.cf-ai-drawer {
    z-index: 1800;
    inset: 0;
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    transform: translateY(105%);
  }

  #assistant-section.cf-ai-drawer.is-open {
    transform: translateY(0);
  }

  .cf-ai-launcher {
    right: 16px;
    bottom:
      calc(
        78px +
        env(safe-area-inset-bottom)
      );
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .cf-ai-drawer .cf-ai-topbar {
    padding-top:
      calc(
        12px +
        env(safe-area-inset-top)
      );
  }
}

@media (prefers-reduced-motion: reduce) {
  #assistant-section.cf-ai-drawer,
  .cf-ai-launcher {
    transition: none;
  }
}

/*
 * Compact Assistant drawer layout v2.
 *
 * Adapts the original full-page Assistant composition to the
 * persistent desktop drawer while preserving the mobile panel.
 */

@media (min-width: 768px) {
  #assistant-section.cf-ai-drawer {
    width: min(520px, calc(100vw - 32px));
  }
}

.cf-ai-drawer .cf-ai-topbar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  min-height: 0;
  padding: 16px 64px 14px 18px;
}

.cf-ai-drawer .cf-ai-title-wrap {
  width: 100%;
}

.cf-ai-drawer .cf-ai-title-wrap > div {
  align-items: flex-start !important;
}

.cf-ai-drawer .cf-ai-title {
  font-size: 17px;
  line-height: 1.25;
}

.cf-ai-drawer .cf-ai-subtitle {
  max-width: 340px;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.45;
}

.cf-ai-drawer .cf-ai-top-actions {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.cf-ai-drawer .cf-ai-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.cf-ai-drawer .cf-ai-read-only {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 9px;
}

.cf-ai-drawer .cf-ai-insights-control {
  min-width: 0;
}

.cf-ai-drawer .cf-ai-insights-button {
  max-width: 210px;
  min-height: 32px;
}

.cf-ai-drawer .cf-ai-transcript {
  padding: 20px 18px 126px;
}

.cf-ai-drawer .cf-ai-empty {
  justify-content: flex-start;
  min-height: 0;
  padding: 36px 8px 18px;
}

.cf-ai-drawer .cf-ai-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 16px;
  font-size: 22px;
}

.cf-ai-drawer .cf-ai-greeting {
  font-size: 25px;
  line-height: 1.2;
}

.cf-ai-drawer .cf-ai-question {
  margin-top: 6px;
  font-size: 13px;
}

.cf-ai-drawer .cf-ai-quick-prompts {
  display: grid;
  width: min(100%, 410px);
  max-width: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 22px;
}

.cf-ai-drawer .cf-ai-quick-prompt {
  min-width: 0;
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 11px;
  white-space: normal;
  line-height: 1.3;
  text-align: center;
}

.cf-ai-drawer .cf-ai-bubble {
  max-width: 92%;
}

.cf-ai-drawer .cf-ai-composer-wrap {
  padding: 18px 16px 14px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0),
      #ffffff 24%
    );
}

.cf-ai-drawer .cf-ai-composer {
  width: 100%;
  max-width: none;
}

@media (max-width: 767px) {
  .cf-ai-drawer .cf-ai-topbar {
    padding-top:
      calc(
        14px +
        env(safe-area-inset-top)
      );
    padding-right: 58px;
    padding-bottom: 12px;
    padding-left: 14px;
  }

  .cf-ai-drawer .cf-ai-close {
    top:
      calc(
        14px +
        env(safe-area-inset-top)
      );
    right: 14px;
  }

  .cf-ai-drawer .cf-ai-subtitle {
    display: block;
    max-width: 300px;
  }

  .cf-ai-drawer .cf-ai-transcript {
    padding:
      18px
      14px
      calc(
        124px +
        env(safe-area-inset-bottom)
      );
  }

  .cf-ai-drawer .cf-ai-empty {
    padding-top: 28px;
  }

  .cf-ai-drawer .cf-ai-quick-prompts {
    width: 100%;
    max-width: 430px;
  }

  .cf-ai-drawer .cf-ai-composer-wrap {
    padding:
      18px
      12px
      calc(
        10px +
        env(safe-area-inset-bottom)
      );
  }
}

@media (max-width: 380px) {
  .cf-ai-drawer .cf-ai-top-actions {
    flex-wrap: wrap;
  }

  .cf-ai-drawer .cf-ai-subtitle {
    display: none;
  }

  .cf-ai-drawer .cf-ai-quick-prompts {
    grid-template-columns: 1fr;
  }

  .cf-ai-drawer .cf-ai-empty {
    padding-top: 20px;
  }
}

/*
 * Collapsible conversation rail and structured answers v3.
 */

.cf-ai-drawer .cf-ai-rail {
  width: min(272px, calc(100% - 58px));
  padding: 14px;
  background: #ffffff;
  border-right: 1px solid #dce6f3;
  box-shadow:
    12px 0 34px rgba(15, 31, 61, 0.14);
}

.cf-ai-rail-top {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 0 2px 10px;
  border-bottom: 1px solid #e6edf6;
  color: var(--text, #0f1f3d);
  font-size: 13px;
}

.cf-ai-rail-close {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  background: #f7f9fc;
  border: 1px solid #dce4ef;
  border-radius: 9px;
  color: #5f708b;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.cf-ai-rail-close:hover,
.cf-ai-rail-close:focus-visible {
  background: #edf5ff;
  border-color: #9fc1f7;
  color: #1758b8;
}

.cf-ai-drawer .cf-ai-new-chat {
  min-height: 40px;
  margin-bottom: 16px;
  background: #edf5ff;
  border-color: #bdd6ff;
  color: #1758b8;
  box-shadow: none;
}

.cf-ai-drawer .cf-ai-rail-heading {
  margin: 15px 3px 8px;
  color: #7485a0;
  font-size: 9px;
}

.cf-ai-drawer .cf-ai-rail-list {
  gap: 7px;
}

.cf-ai-drawer .cf-ai-rail-item {
  min-height: 40px;
  padding: 9px 10px;
  background: #f8fafd;
  border-color: #e3eaf4;
  color: #425574;
}

.cf-ai-drawer .cf-ai-rail-item:hover,
.cf-ai-drawer .cf-ai-rail-item.active {
  background: #edf5ff;
  border-color: #bdd6ff;
  color: #173f7a;
}

.cf-ai-drawer .cf-ai-privacy-note {
  padding: 10px;
  background: #f8fafd;
  border-color: #e3eaf4;
  font-size: 9px;
}

.cf-ai-rail-backdrop {
  position: absolute;
  z-index: 35;
  inset: 0;
  display: block;
  padding: 0;
  background: rgba(15, 31, 61, 0.16);
  border: 0;
  opacity: 0;
  pointer-events: none;
  cursor: default;
  transition: opacity 0.18s ease;
}

.cf-ai-shell.rail-open
.cf-ai-rail-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.cf-ai-drawer
.cf-ai-mobile-rail-toggle[aria-expanded="true"] {
  background: #edf5ff;
  border-color: #9fc1f7;
  color: #1758b8;
}

.cf-ai-message.assistant
.cf-ai-bubble.has-structured-steps {
  width: min(100%, 430px);
  max-width: 96%;
  padding: 12px;
  background: #f8fafd;
}

.cf-ai-answer-intro {
  margin-bottom: 10px;
  padding: 0 2px;
  color: #425574;
}

.cf-ai-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: cf-ai-step;
}

.cf-ai-step {
  position: relative;
  min-height: 44px;
  padding: 11px 12px 11px 43px;
  background: #ffffff;
  border: 1px solid #e0e8f3;
  border-radius: 11px;
  color: #243955;
  line-height: 1.52;
  counter-increment: cf-ai-step;
}

.cf-ai-step::before {
  content: counter(cf-ai-step);
  position: absolute;
  top: 10px;
  left: 11px;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  background: #edf5ff;
  border: 1px solid #c7dcff;
  border-radius: 50%;
  color: #1758b8;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

@media (max-width: 767px) {
  .cf-ai-drawer .cf-ai-rail {
    width: min(320px, calc(100% - 48px));
  }

  .cf-ai-message.assistant
  .cf-ai-bubble.has-structured-steps {
    width: 100%;
    max-width: 100%;
  }

  .cf-ai-step {
    padding-right: 10px;
    padding-left: 41px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cf-ai-rail-backdrop {
    transition: none;
  }
}

/*
 * Assistant compact and full workspace modes v4.
 *
 * Wide desktops reserve room for the compact Assistant. Smaller
 * screens use an overlay. Expanded mode occupies the operational
 * workspace while preserving the Agency navigation.
 */

.cf-ai-expand {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  background: #ffffff;
  border: 1px solid var(--border, #dce4ef);
  border-radius: 10px;
  color: var(--text-muted, #5f708b);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.cf-ai-expand:hover,
.cf-ai-expand:focus-visible,
.cf-ai-expand[aria-pressed="true"] {
  background: #edf5ff;
  border-color: #9fc1f7;
  color: #1758b8;
}

#app-screen .page-wrap {
  transition:
    padding-left 0.2s ease,
    padding-right 0.24s ease;
}

@media (min-width: 1440px) {
  body.cf-ai-drawer-open:not(.cf-ai-assistant-expanded)
  #app-screen .page-wrap {
    padding-right: 568px;
  }
}

@media (min-width: 901px) {
  #assistant-section.cf-ai-drawer.is-expanded {
    top: 76px;
    right: 16px;
    bottom: 16px;
    left: 232px;
    width: auto;
    max-width: none;
    border-radius: 20px;
  }

  body.agency-sidebar-collapsed
  #assistant-section.cf-ai-drawer.is-expanded {
    left: 92px;
  }

  #assistant-section.cf-ai-drawer.is-expanded
  .cf-ai-topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding:
      16px
      64px
      14px
      22px;
  }

  #assistant-section.cf-ai-drawer.is-expanded
  .cf-ai-title-wrap {
    width: auto;
  }

  #assistant-section.cf-ai-drawer.is-expanded
  .cf-ai-top-actions {
    width: auto;
  }

  #assistant-section.cf-ai-drawer.is-expanded
  .cf-ai-subtitle {
    max-width: 620px;
    font-size: 11px;
  }

  #assistant-section.cf-ai-drawer.is-expanded
  .cf-ai-transcript {
    padding:
      28px
      clamp(24px, 5vw, 72px)
      134px;
  }

  #assistant-section.cf-ai-drawer.is-expanded
  .cf-ai-bubble {
    max-width: min(860px, 82%);
  }

  #assistant-section.cf-ai-drawer.is-expanded
  .cf-ai-bubble.has-structured-steps {
    width: min(100%, 820px);
    max-width: 88%;
  }

  #assistant-section.cf-ai-drawer.is-expanded
  .cf-ai-composer-wrap {
    padding-right:
      clamp(24px, 5vw, 72px);
    padding-left:
      clamp(24px, 5vw, 72px);
  }
}

@media (max-width: 900px) {
  .cf-ai-expand {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #app-screen .page-wrap,
  #assistant-section.cf-ai-drawer {
    transition: none;
  }
}


/* Optional examples within the existing Assistant answer, not a second help drawer. */
.cf-ai-help-visual { margin-top:12px; border:1px solid var(--border,#dce3ec); border-radius:10px; padding:10px; }
.cf-ai-help-visual summary { cursor:pointer; font-weight:600; line-height:1.5; }
.cf-ai-help-image { display:block; width:100%; height:auto; border-radius:6px; margin-top:8px; }
.cf-ai-help-image:not([src]),.cf-ai-help-image[hidden] { display:none; }
.cf-ai-help-caption { font-size:12px; line-height:1.5; opacity:.8; }
.cf-ai-help-image-toggle { display:block; width:100%; border:0; padding:0; margin:0; border-radius:6px; background:transparent; cursor:zoom-in; }
.cf-ai-help-image-toggle:focus-visible { outline:3px solid #16a38a; outline-offset:4px; }
.cf-ai-help-image-toggle:disabled { cursor:wait; }
.cf-ai-help-image-in-zoom { visibility:hidden; }
.cf-ai-help-zoom { position:fixed; inset:0; width:100vw; height:100vh; height:100dvh; max-width:none; max-height:none; margin:0; padding:0; border:0; overflow:auto; overscroll-behavior:contain; background:rgba(9,23,42,.94); color:#fff; }
.cf-ai-help-zoom::backdrop { background:rgba(9,23,42,.7); }
.cf-ai-help-zoom-toolbar { position:sticky; top:0; left:0; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:16px; width:100vw; padding:12px 20px; background:#132b45; font:14px/1.5 system-ui,sans-serif; }
.cf-ai-help-zoom-close { flex-shrink:0; padding:8px 12px; border:1px solid #7890aa; border-radius:8px; color:#fff; background:#203c59; cursor:pointer; font:inherit; }
.cf-ai-help-zoom-canvas { width:max-content; min-width:100%; padding:20px 24px 36px; }
.cf-ai-help-zoom-toggle { display:block; width:min(1200px,max(760px,calc(100vw - 48px))); margin:0 auto; padding:0; border:0; border-radius:8px; background:transparent; cursor:zoom-out; }
.cf-ai-help-zoom-image { display:block; width:100%; max-width:none; height:auto; border-radius:8px; transform-origin:top left; }
.cf-ai-help-zoom-toggle:focus-visible,.cf-ai-help-zoom-close:focus-visible { outline:3px solid #65dbc2; outline-offset:4px; }
@media(max-width:600px) { .cf-ai-help-zoom-toolbar { padding:10px 12px; gap:10px; font-size:12px; } .cf-ai-help-zoom-canvas { padding:12px 12px 24px; } }
@media(prefers-reduced-motion:reduce) { .cf-ai-help-zoom,.cf-ai-help-zoom-image { animation:none!important; transition:none!important; } }

/* Assistant conversation menu button v1 */
#cf-ai-mobile-rail-toggle {
  appearance:none;
  -webkit-appearance:none;
  place-items:center;
  flex:0 0 auto;
  width:38px;
  height:38px;
  margin:0;
  padding:0;
  border:1px solid var(--border, #dce4ef);
  border-radius:12px;
  background:var(--bg, #f5f7fb);
  color:var(--text-muted, #5f708b);
  font-size:0;
  line-height:1;
  cursor:pointer;
  transition:background .16s ease, border-color .16s ease,
             color .16s ease, transform .16s ease;
}
#cf-ai-mobile-rail-toggle::before {
  content:"";
  display:block;
  width:18px;
  height:2px;
  border-radius:999px;
  background:currentColor;
  box-shadow:0 -6px 0 currentColor, 0 6px 0 currentColor;
  pointer-events:none;
}
#cf-ai-mobile-rail-toggle:hover,
#cf-ai-mobile-rail-toggle[aria-expanded="true"] {
  background:var(--blue-light, rgba(59,130,246,.08));
  border-color:var(--blue, #3b82f6);
  color:var(--blue, #3b82f6);
}
#cf-ai-mobile-rail-toggle:focus-visible {
  outline:3px solid var(--blue, #3b82f6);
  outline-offset:3px;
}
#cf-ai-mobile-rail-toggle:active {
  transform:scale(.97);
}
@media (prefers-reduced-motion:reduce) {
  #cf-ai-mobile-rail-toggle {
    transition:none;
    transform:none;
  }
}

/* Smooth Assistant compact and expanded sizes v1 */
@media (min-width:901px) {
  #assistant-section.cf-ai-drawer {
    left:auto;
    transition:
      width .34s cubic-bezier(.22,1,.36,1),
      transform .24s cubic-bezier(.32,.72,0,1),
      opacity .2s ease,
      visibility .2s ease;
  }
  #assistant-section.cf-ai-drawer.is-expanded {
    left:auto;
    right:16px;
    width:calc(100vw - 248px);
  }
  body.agency-sidebar-collapsed
  #assistant-section.cf-ai-drawer.is-expanded {
    left:auto;
    width:calc(100vw - 108px);
  }

  #assistant-section.cf-ai-drawer.is-expanded .cf-ai-topbar {
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
    padding:16px 64px 14px 18px;
  }
  #assistant-section.cf-ai-drawer.is-expanded .cf-ai-title-wrap,
  #assistant-section.cf-ai-drawer.is-expanded .cf-ai-top-actions {
    width:100%;
  }
  #assistant-section.cf-ai-drawer.is-expanded .cf-ai-subtitle {
    font-size:10px;
  }
  #assistant-section.cf-ai-drawer .cf-ai-subtitle {
    transition:max-width .34s cubic-bezier(.22,1,.36,1);
  }
  #assistant-section.cf-ai-drawer .cf-ai-transcript,
  #assistant-section.cf-ai-drawer .cf-ai-composer-wrap {
    transition:padding .34s cubic-bezier(.22,1,.36,1);
  }

  #cf-ai-expand {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    width:auto;
    min-width:88px;
    height:38px;
    padding:0 10px;
    border:1px solid var(--border, #dce4ef);
    border-radius:12px;
    background:var(--bg, #f5f7fb);
    color:var(--text-muted, #5f708b);
    font-size:0;
    line-height:1;
    cursor:pointer;
    transition:background .16s ease, border-color .16s ease, color .16s ease;
  }
  #cf-ai-expand::before {
    content:"↗";
    font-size:16px;
  }
  #cf-ai-expand[aria-pressed="true"]::before {
    content:"↙";
  }
  #cf-ai-expand::after {
    content:"Expand";
    font-size:12px;
    font-weight:700;
  }
  #cf-ai-expand[aria-pressed="true"]::after {
    content:"Compact";
  }
  #cf-ai-expand:hover,
  #cf-ai-expand[aria-pressed="true"] {
    background:var(--blue-light, rgba(59,130,246,.08));
    border-color:var(--blue, #3b82f6);
    color:var(--blue, #3b82f6);
  }
  #cf-ai-expand:focus-visible {
    outline:3px solid var(--blue, #3b82f6);
    outline-offset:3px;
  }
}
@media (prefers-reduced-motion:reduce) {
  #assistant-section.cf-ai-drawer,
  #assistant-section.cf-ai-drawer .cf-ai-subtitle,
  #assistant-section.cf-ai-drawer .cf-ai-transcript,
  #assistant-section.cf-ai-drawer .cf-ai-composer-wrap,
  #cf-ai-expand {
    transition:none;
  }
}
