/* AI assistant modal. Why: keep the assistant polished, chat-like, and clearly separate from the canvas. */
.df-ai-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.30);
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease;
  z-index:1450;
}
.df-ai-backdrop.open{
  opacity:1;
  pointer-events:auto;
}
.df-ai-panel{
  position:fixed;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  width:min(860px, calc(100vw - 44px));
  max-height:min(82vh, 820px);
  display:none;
  flex-direction:column;
  background:#fff;
  border:1px solid rgba(15,23,42,.08);
  border-radius:20px;
  box-shadow:0 28px 90px rgba(15,23,42,.20);
  overflow:hidden;
  z-index:1451;
}
.df-ai-panel.open{
  display:flex;
}
.df-ai-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding:18px 20px 16px;
  border-bottom:1px solid rgba(15,23,42,.06);
  background:linear-gradient(180deg, rgba(248,250,252,.98) 0%, rgba(255,255,255,.98) 100%);
}
.df-ai-title{
  font-size:16px;
  font-weight:800;
  line-height:1.25;
  color:#0f172a;
}
.df-ai-sub{
  margin-top:4px;
  font-size:12px;
  line-height:1.5;
  color:#64748b;
  max-width:620px;
}
.df-ai-close{
  appearance:none;
  border:1px solid rgba(15,23,42,.1);
  background:#fff;
  border-radius:999px;
  width:34px;
  height:34px;
  cursor:pointer;
  color:#475569;
  font-size:18px;
  line-height:1;
  flex:0 0 auto;
}
.df-ai-close:hover{ background:#f8fafc; }

.df-ai-context{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding:12px 20px 0;
  background:#fff;
}
.df-ai-chip{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid rgba(15,23,42,.08);
  background:#f8fafc;
  font-size:11.5px;
  font-weight:700;
  color:#475569;
}
.df-ai-thread{
  flex:1 1 auto;
  overflow:auto;
  padding:18px 20px 12px;
  background:#fff;
  min-height:250px;
}
.df-ai-empty-thread{
  border:1px dashed rgba(15,23,42,.12);
  border-radius:16px;
  padding:18px;
  font-size:12.5px;
  line-height:1.6;
  color:#64748b;
  background:#fbfdff;
}
.df-ai-msg{
  display:flex;
  margin-bottom:12px;
}
.df-ai-msg-user{ justify-content:flex-end; }
.df-ai-msg-assistant{ justify-content:flex-start; }
.df-ai-msg-bubble{
  max-width:min(82%, 660px);
  padding:12px 14px;
  border-radius:16px;
  font-size:13px;
  line-height:1.65;
  white-space:pre-wrap;
}
.df-ai-msg-user .df-ai-msg-bubble{
  background:#2563eb;
  color:#fff;
  border-bottom-right-radius:6px;
}
.df-ai-msg-assistant .df-ai-msg-bubble{
  background:#f8fafc;
  color:#0f172a;
  border:1px solid rgba(15,23,42,.06);
  border-bottom-left-radius:6px;
}
.df-ai-plan-wrap{
  padding:0 20px 14px;
  background:#fff;
}
.df-ai-label{
  margin-bottom:8px;
  font-size:12px;
  font-weight:700;
  color:#334155;
}
.df-ai-plan{
  border:1px solid rgba(15,23,42,.07);
  border-radius:18px;
  padding:12px;
  background:#fbfdff;
  min-height:74px;
}
.df-ai-empty{
  border:1px dashed rgba(15,23,42,.12);
  border-radius:14px;
  padding:14px;
  font-size:12px;
  line-height:1.5;
  color:#64748b;
  background:#fff;
}
.df-ai-plan-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.df-ai-plan-row{
  border:1px solid rgba(15,23,42,.07);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.df-ai-plan-row-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.df-ai-plan-title{
  font-size:13px;
  font-weight:700;
  line-height:1.45;
  color:#0f172a;
}
.df-ai-plan-note{
  margin-top:7px;
  font-size:12px;
  line-height:1.5;
  color:#475569;
}
.df-ai-plan-badge{
  display:inline-flex;
  align-items:center;
  min-height:24px;
  border-radius:999px;
  padding:0 9px;
  font-size:11px;
  font-weight:700;
  white-space:nowrap;
}
.df-ai-plan-badge-matched{ background:rgba(22,163,74,.10); color:#166534; }
.df-ai-plan-badge-added{ background:rgba(59,130,246,.12); color:#1d4ed8; }
.df-ai-plan-badge-needs-confirmation{ background:rgba(245,158,11,.12); color:#92400e; }
.df-ai-plan-badge-no-match{ background:rgba(239,68,68,.10); color:#991b1b; }
.df-ai-plan-badge-already-added{ background:rgba(100,116,139,.12); color:#475569; }

.df-ai-plan-options{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}
.df-ai-option{
  appearance:none;
  border:1px solid rgba(15,23,42,.12);
  background:#fff;
  color:#334155;
  border-radius:999px;
  min-height:30px;
  padding:0 12px;
  font-size:12px;
  cursor:pointer;
}
.df-ai-option.selected,
.df-ai-option:hover{
  background:#eff6ff;
  border-color:rgba(37,99,235,.28);
  color:#1d4ed8;
}

.df-ai-compose{
  padding:0 20px 12px;
  background:#fff;
}
.df-ai-input{
  display:block;
  width:100%;
  min-height:84px;
  resize:vertical;
  border:1px solid rgba(15,23,42,.10);
  border-radius:16px;
  padding:12px 14px;
  font:inherit;
  font-size:13px;
  line-height:1.55;
  color:#0f172a;
  background:#fff;
}
.df-ai-input::placeholder{
  color:#94a3b8;
}
.df-ai-input:focus{
  outline:none;
  border-color:rgba(37,99,235,.34);
  box-shadow:0 0 0 3px rgba(37,99,235,.08);
}
.df-ai-quick{
  margin-top:10px;
  min-height:22px;
}
.df-ai-quick-replies{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.df-ai-quick-reply{
  appearance:none;
  border:1px solid rgba(15,23,42,.10);
  background:#f8fafc;
  color:#334155;
  border-radius:999px;
  min-height:30px;
  padding:0 12px;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
}
.df-ai-quick-reply:hover{
  background:#eff6ff;
  border-color:rgba(37,99,235,.24);
  color:#1d4ed8;
}

.df-ai-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 20px 18px;
  border-top:1px solid rgba(15,23,42,.06);
  background:#fff;
}
.df-ai-status{
  min-width:0;
  font-size:12px;
  line-height:1.5;
  color:#64748b;
}
.df-ai-actions{
  display:flex;
  align-items:center;
  gap:8px;
}
.df-ai-btn{
  appearance:none;
  border:1px solid rgba(15,23,42,.10);
  background:#fff;
  color:#334155;
  border-radius:12px;
  min-height:36px;
  padding:0 14px;
  font-size:12.5px;
  font-weight:700;
  cursor:pointer;
}
.df-ai-btn:hover{
  background:#f8fafc;
}
.df-ai-btn:disabled{
  cursor:not-allowed;
  opacity:.5;
}
.df-ai-btn-primary{
  background:#2563eb;
  border-color:#2563eb;
  color:#fff;
}
.df-ai-btn-primary:hover{
  background:#1d4ed8;
}

@media (max-width: 860px){
  .df-ai-panel{
    width:calc(100vw - 22px);
    max-height:calc(100vh - 20px);
    border-radius:18px;
  }
  .df-ai-thread{
    min-height:220px;
  }
  .df-ai-footer{
    flex-direction:column;
    align-items:stretch;
  }
  .df-ai-actions{
    justify-content:flex-end;
  }
}


/* Helpbox mode. Why: present the launcher modal as a practical guide, not a freeform AI bot. */
.df-ai-panel{
  width:min(780px, calc(100vw - 44px));
  max-height:min(80vh, 780px);
}
.df-ai-head{
  padding:18px 20px 14px;
}
.df-ai-title{
  font-size:15px;
  font-weight:800;
}
.df-ai-sub{
  max-width:580px;
}
.df-ai-topics{
  padding:12px 20px 0;
  background:#fff;
}
.df-ai-topic-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
}
.df-ai-topic-card{
  appearance:none;
  border:1px solid rgba(15,23,42,.08);
  background:#fbfdff;
  border-radius:16px;
  padding:12px 13px;
  text-align:left;
  cursor:pointer;
  transition:border-color .15s ease, background .15s ease, transform .15s ease;
}
.df-ai-topic-card:hover{
  border-color:rgba(37,99,235,.22);
  background:#eff6ff;
  transform:translateY(-1px);
}
.df-ai-topic-card-title{
  display:block;
  font-size:12.5px;
  font-weight:700;
  line-height:1.45;
  color:#0f172a;
}
.df-ai-thread{
  min-height:220px;
}
.df-ai-msg-bubble{
  max-width:min(86%, 680px);
}
.df-ai-msg-assistant .df-ai-msg-bubble{
  background:#f8fafc;
}
.df-ai-compose{
  padding:14px 20px 12px;
}
.df-ai-input{
  min-height:72px;
}
.df-ai-footer{
  padding:12px 20px 18px;
}
@media (max-width: 860px){
  .df-ai-topic-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px){
  .df-ai-topic-grid{
    grid-template-columns:1fr;
  }
}
