/* ============================================================
   AI ASSISTANT styles
   ============================================================ */
.ai-panel{
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  overflow: hidden;
  height: 100%;
  min-height: 0;
}
.ai-head{
  display: flex; align-items: center; gap: 11px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}
.ai-head-ic{
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
}
.ai-head-ic.sm{ width: 26px; height: 26px; border-radius: 7px; }
.ai-head-title{ font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.ai-head-sub{ font-size: 12px; color: var(--muted); }

.ai-body{
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}

/* empty state */
.ai-intro{ font-size: 13.5px; color: var(--ink-2); line-height: 1.5; margin: 0 0 16px; }
.ai-sub{ font-family: var(--ff-mono); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: 9px; }
.ai-chips{ display: flex; flex-direction: column; gap: 7px; }
.ai-chip{
  display: flex; align-items: center; gap: 9px;
  text-align: left;
  font-family: var(--ff-sans); font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; cursor: pointer;
  transition: background .14s, border-color .14s, color .14s, transform .08s;
}
.ai-chip svg{ color: var(--accent); flex: none; }
.ai-chip:hover{ background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.ai-chip:active{ transform: translateY(.5px); }

/* question bubble */
.ai-q{ display: flex; justify-content: flex-end; }
.ai-q span{
  background: var(--accent); color: #fff;
  font-size: 13.5px; font-weight: 500; line-height: 1.45;
  padding: 9px 13px; border-radius: 13px 13px 4px 13px;
  max-width: 86%;
}

/* answer */
.ai-answer{ display: flex; flex-direction: column; gap: 13px; }
.ai-safety{
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  min-height: 26px; padding: 4px 9px; border-radius: 7px;
  font-size: 11.5px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.ai-safety svg{ flex: none; }
.ai-safety--ok{ color: var(--st-clear); border-color: #bfe0d6; background: #edf8f4; }
.ai-safety--review{ color: var(--st-process); border-color: #e6c6ab; background: #fbf1e8; }
.ai-safety--refused,.ai-safety--off{ color: var(--st-grave); border-color: #e6bcbc; background: #fbefef; }
.ai-safety-reason{ color: var(--muted); font-family: var(--ff-mono); font-size: 10px; font-weight: 600; }
.ai-answer-text{ font-size: 14px; color: var(--ink); line-height: 1.55; }
.ai-answer-text p{ margin: 0 0 8px; }
.ai-answer-text p:last-child{ margin-bottom: 0; }
.ai-ul{ margin: 4px 0 8px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.ai-ul li{ position: relative; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.ai-ul li::before{ content: ''; position: absolute; left: 4px; top: 8px; width: 5px; height: 5px; border-radius: 999px; background: var(--accent); }

.ai-sources{ display: flex; flex-direction: column; gap: 7px; padding-top: 2px; }
.ai-src{
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px;
  transition: border-color .14s, background .14s;
}
.ai-src:hover{ border-color: var(--accent-line); background: var(--accent-soft); }
.ai-src-ic{ width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.ai-src-body{ display: flex; flex-direction: column; min-width: 0; }
.ai-src-name{ font-size: 13px; font-weight: 600; color: var(--ink); }
.ai-src-detail{ font-size: 11.5px; color: var(--muted); }
.ai-citations{ display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.ai-citation{
  display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px;
  border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.ai-citation--supported{ color: var(--st-clear); border-color: #bfe0d6; background: #edf8f4; }
.ai-citation--partially_supported{ color: var(--st-watch); border-color: #ecdcc0; background: #f7efe2; }
.ai-citation--unsupported,.ai-citation--source_missing{ color: var(--st-grave); border-color: #e6bcbc; background: #fbefef; }

.ai-meta{ display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ai-fresh{ display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }

.ai-caveat{
  display: flex; gap: 9px;
  font-size: 12.5px; color: #87662f; line-height: 1.45;
  background: #f7efe2; border: 1px solid #ecdcc0;
  border-radius: 9px; padding: 10px 11px;
}
.ai-caveat svg{ flex: none; color: var(--st-watch); margin-top: 1px; }
.ai-correction{
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  font-size: 12.5px; font-weight: 700; color: var(--accent);
  text-decoration: none; border-bottom: 1px solid var(--accent-line);
}

.ai-followups{ display: flex; flex-direction: column; gap: 7px; }
.ai-followups .chip{ justify-content: space-between; width: 100%; font-weight: 500; }
.ai-followups .chip svg{ color: var(--faint); }
.ai-feedback{ display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding-top: 2px; }
.ai-feedback button{
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--surface);
  color: var(--ink-2); font: 700 11.5px var(--ff-sans); cursor: pointer;
}
.ai-feedback button:hover{ border-color: var(--accent-line); color: var(--accent); }
.ai-feedback span{ font-size: 11.5px; color: var(--muted); }

/* thinking */
.ai-thinking{ display: flex; align-items: center; gap: 10px; }
.ai-dots{ display: inline-flex; gap: 4px; }
.ai-dots i{ width: 6px; height: 6px; border-radius: 999px; background: var(--accent); opacity: .35; animation: aiDot 1s infinite; }
.ai-dots i:nth-child(2){ animation-delay: .15s; } .ai-dots i:nth-child(3){ animation-delay: .3s; }
@keyframes aiDot{ 0%,100%{ opacity: .25; transform: translateY(0); } 40%{ opacity: 1; transform: translateY(-3px); } }

/* input */
.ai-input{
  display: flex; align-items: flex-end; gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid var(--line-2);
  background: var(--surface);
}
.ai-input textarea{
  flex: 1; resize: none;
  font-family: var(--ff-sans); font-size: 14px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; max-height: 120px;
  color: var(--ink); background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s, background .15s;
  line-height: 1.4;
}
.ai-input textarea:focus{ outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.ai-send{
  flex: none; width: 40px; height: 40px;
  border: none; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s, transform .08s;
}
.ai-send:hover:not(:disabled){ background: var(--accent-ink); }
.ai-send:active:not(:disabled){ transform: translateY(.5px); }
.ai-send:disabled{ background: #c4ccd6; cursor: default; }
.ai-foot{ display: flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--line-2); background: var(--surface-2); }
.ai-foot svg{ flex: none; }
