/* ============================================================
   AI Assistant (client) — page-specific styles
   ============================================================ */

.ai-main { padding: 28px 0 140px; }

.ai-page {
  max-width: 860px;
  margin: 0 auto;
}

.ai-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.ai-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.ai-orb {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--dark);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
}
.ai-orb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(242,198,0,0.55), transparent 60%);
}
.ai-orb .ms {
  position: relative;
  color: var(--signal);
  font-size: 22px;
}
.ai-brand .b-text .n {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-brand .b-text .n .ms-fill { color: var(--info); font-size: 16px; }
.ai-brand .b-text .s {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ai-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.ai-meta .stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
}
.ai-meta .stat strong { color: var(--text); }
.ai-meta .stat .mono { color: var(--text); font-weight: 500; }

/* conversation stream */
.ai-stream {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.ai-bubble-user {
  align-self: flex-end;
  background: var(--dark);
  color: var(--text-on-dark);
  border-radius: 20px 20px 4px 20px;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.4;
  max-width: 70%;
}
.ai-bubble-user .meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(247,246,242,0.4);
  margin-top: 6px;
}

.ai-response {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  max-width: 100%;
}
.ai-response-av {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--dark);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.ai-response-av::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(242,198,0,0.55), transparent 60%);
}
.ai-response-av .ms { position: relative; color: var(--signal); font-size: 18px; }

.ai-response-body { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.ai-think {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-think .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--go);
  animation: typing 1.2s ease-in-out infinite;
}

.ai-message {
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
}
.ai-message p { margin: 0 0 10px; }
.ai-message p:last-child { margin-bottom: 0; }
.ai-message strong { font-weight: 600; }

/* diagnostic card */
.diag-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.diag-head {
  padding: 18px 22px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border-bottom: 1px solid var(--line);
}
.diag-head h3 {
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.diag-head h3 .ms { color: var(--info); font-size: 18px; }
.diag-head .s {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.diag-causes { padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.cause {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 120ms ease;
}
.cause:hover { border-color: var(--text); }
.cause.primary {
  background: linear-gradient(135deg, rgba(242, 198, 0, 0.12), transparent);
  border-color: var(--signal);
}
.cause-rank {
  width: 36px; height: 36px;
  border-radius: var(--r-pill);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
}
.cause.primary .cause-rank { background: var(--signal); color: var(--signal-on); border-color: var(--signal); }
.cause-info .n {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cause-info .d {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.cause-info .d .mono { color: var(--text); }
.cause-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.confidence {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.confidence-track {
  width: 56px;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.confidence-track > span {
  display: block;
  height: 100%;
  background: var(--dark);
  border-radius: var(--r-pill);
}
.cause.primary .confidence-track > span { background: var(--signal); }
.cause-price {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.cause-price strong { color: var(--text); font-weight: 600; }

.diag-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  background: var(--surface-2);
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--text-muted);
}
.diag-foot .similar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.diag-foot .similar .ms { font-size: 14px; }
.diag-foot .similar strong { color: var(--text); font-weight: 600; }

/* suggested centers */
.suggested-centers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.sg-center {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}
.sg-center:hover { border-color: var(--text); transform: translateY(-1px); }
.sg-center.featured { border-color: var(--dark); border-width: 1.5px; }

.sg-top { display: flex; justify-content: space-between; align-items: center; }
.sg-rank {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-2);
}
.sg-center.featured .sg-rank { background: var(--dark); color: var(--text-on-dark); }
.sg-rating {
  font-size: 12px;
  font-weight: 600;
}
.sg-rating .ms {
  color: var(--signal);
  font-size: 12px;
  font-variation-settings: 'opsz' 20, 'wght' 600, 'FILL' 1, 'GRAD' 0;
}

.sg-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sg-detail {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sg-detail .mono { color: var(--text-2); }

.sg-slot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--go);
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.sg-slot .ms { font-size: 14px; }

/* action buttons row */
.ai-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 120ms ease;
}
.ai-action:hover { background: var(--surface-3); color: var(--text); }
.ai-action.primary {
  background: var(--dark);
  color: var(--text-on-dark);
  border-color: var(--dark);
}
.ai-action.primary:hover { background: var(--dark-2); color: var(--text-on-dark); }
.ai-action .ms { font-size: 16px; }

/* welcome / empty state */
.welcome-state {
  text-align: center;
  padding: 40px 20px 28px;
}
.welcome-state h1 {
  font-family: var(--font-display);
  font-size: 38px;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 12px;
}
.welcome-state h1 em {
  font-style: normal;
  color: var(--text-muted);
}
.welcome-state p {
  font-size: 15px;
  color: var(--text-2);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.55;
}
.prompt-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 28px;
}
.prompt-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 120ms ease, transform 120ms ease;
}
.prompt-card:hover { border-color: var(--text); transform: translateY(-1px); }
.prompt-card .ic {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.prompt-card .ic .ms { font-size: 16px; }
.prompt-card .t {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.4;
}
.prompt-card .t .sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== STICKY COMPOSER ===== */
.ai-composer {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 80px));
  z-index: 30;
}

.ai-composer-box {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  padding: 8px 8px 8px 14px;
  align-items: center;
  box-shadow: var(--sh-3);
}
.ai-composer-box.dark {
  background: var(--dark);
  border-color: var(--dark);
}
.ai-composer-box.dark .composer-input { color: var(--text-on-dark); }
.ai-composer-box.dark .composer-input::placeholder { color: rgba(247,246,242,0.4); }
.ai-composer-box.dark .composer-attach,
.ai-composer-box.dark .composer-voice { color: rgba(247,246,242,0.6); }
.ai-composer-box.dark .composer-attach:hover,
.ai-composer-box.dark .composer-voice:hover { background: rgba(255,255,255,0.06); color: var(--text-on-dark); }
.ai-composer-box.dark .composer-send { background: var(--signal); color: var(--signal-on); }

.composer-modes {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  padding: 0 4px;
}
.composer-mode {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.composer-mode.active {
  background: var(--dark);
  color: var(--text-on-dark);
  border-color: var(--dark);
}
.composer-mode .ms { font-size: 14px; }

/* attached preview */
.attached {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  padding: 0 4px;
}
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text);
}
.att-chip .ms { font-size: 14px; color: var(--text-muted); }
.att-chip button {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-3);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text-2);
}
