/* MineTwin assistant widget. Uses the site tokens; dark and light aware. */

.chat-launch {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 18px 0 12px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border-line);
  font-family: var(--font-cond); font-weight: 600; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  clip-path: var(--bevel-sm);
}
.chat-launch:hover { border-color: var(--gold-hi); color: var(--gold-hi); }
.chat-launch img { width: 24px; height: 24px; }
.chat-launch[hidden] { display: none; }

.chat-nudge {
  position: fixed; right: 20px; bottom: 80px; z-index: 60;
  width: min(320px, calc(100vw - 40px));
  background: var(--panel); border: 1px solid var(--border-line); padding: 14px 40px 14px 16px;
  font-size: 15px; color: var(--text); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.chat-nudge p { margin: 0; color: var(--text); font-weight: 400; }
.chat-nudge .readout { display: block; margin-bottom: 6px; color: var(--gold); }
.chat-nudge button.chat-x { position: absolute; top: 6px; right: 6px; }
.chat-nudge a { display: inline-block; margin-top: 8px; font-family: var(--font-cond); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 14px; }
.chat-nudge[hidden] { display: none; }

.chat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 70;
  width: min(420px, calc(100vw - 40px)); height: min(700px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-line);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.chat-panel[hidden] { display: none; }

.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--border-sub); background: var(--panel);
}
.chat-head img { width: 30px; height: 30px; }
.chat-title { font-family: var(--font-cond); font-weight: 700; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.1; }
.chat-sub { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--text-ghost); margin-top: 3px; }
.chat-head .chat-actions { margin-left: auto; display: flex; gap: 6px; }
.chat-x { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid transparent; background: transparent; color: var(--text-dim); cursor: pointer; }
.chat-x:hover { color: var(--text); border-color: var(--border-sub); }
.chat-x svg { width: 18px; height: 18px; }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }

.msg { max-width: 92%; padding: 10px 14px; font-size: 15px; line-height: 1.55; font-weight: 300; }
.msg p { margin: 0 0 8px; color: inherit; font-weight: inherit; }
.msg p:last-child { margin: 0; }
.msg ul { margin: 6px 0 6px 18px; padding: 0; color: inherit; font-weight: inherit; }
.msg li { margin: 0 0 4px; }
.msg strong { font-weight: 600; color: inherit; }
.msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--border-sub); color: var(--text); }
.msg.user { align-self: flex-end; background: var(--gold-glow); border: 1px solid var(--border); color: var(--text); }
.msg.err { align-self: flex-start; background: transparent; border: 1px solid var(--bad); color: var(--text-dim); }
.msg-meta { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-ghost); margin-bottom: 6px; }

.lead-note { color: var(--gold); padding: 0 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
  background: transparent; color: var(--text-dim); border: 1px solid var(--border-sub);
  font-family: var(--font-cond); font-weight: 600; font-size: 13.5px; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer;
  text-align: left;
}
.chip:hover { color: var(--gold-hi); border-color: var(--border-line); }
.chip.sample { color: var(--gold); border-color: var(--border); }
.chip svg { width: 14px; height: 14px; flex: none; }
.chat-starters { padding: 0 16px 12px; }
.chat-starters .readout { display: block; margin-bottom: 8px; }

.typing { display: inline-flex; gap: 5px; align-items: center; height: 18px; }
.typing i { width: 6px; height: 6px; background: var(--gold); opacity: 0.35; animation: chat-blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes chat-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.agent-card { align-self: stretch; max-width: 100%; border: 1px solid var(--border-line); background: var(--panel); font-size: 14px; }
.agent-card .ac-bar { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border-sub); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-ghost); }
.agent-card .ac-bar .tag { color: var(--gold); }
.agent-card .ac-q { padding: 10px 12px 0; font-family: var(--font-cond); font-weight: 600; font-size: 15px; color: var(--text); }
.agent-card .ac-a { padding: 8px 12px 12px; color: var(--text-dim); font-weight: 300; line-height: 1.5; }
.agent-card .ac-a p { margin: 0 0 8px; }
.agent-card table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 13px; }
.agent-card th, .agent-card td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--border-sub); }
.agent-card th { font-family: var(--font-cond); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 11.5px; color: var(--text-ghost); }
.agent-card td:first-child { color: var(--text); font-weight: 500; }
.agent-card .crit { color: var(--bad); }
.agent-card .ac-foot { padding: 8px 12px; border-top: 1px solid var(--border-sub); font-family: var(--font-mono); font-size: 11px; color: var(--text-ghost); }
.agent-card .ac-foot b { color: var(--good); font-weight: 500; }

.chat-compose { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border-sub); background: var(--panel); align-items: flex-end; }
.chat-compose textarea {
  flex: 1; min-height: 44px; max-height: 140px; padding: 11px 12px; resize: none;
  background: var(--bg); color: var(--text); border: 1px solid var(--border-sub); font: inherit; font-size: 15px; line-height: 1.4;
}
.chat-compose textarea:focus { border-color: var(--gold); outline: none; }
.chat-send { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: var(--gold); color: var(--on-gold); border: 0; cursor: pointer; clip-path: var(--bevel-sm); }
.chat-send:hover { background: var(--gold-hi); }
.chat-send:disabled { opacity: 0.5; cursor: default; }
.chat-send svg { width: 18px; height: 18px; }

.chat-foot { display: flex; justify-content: space-between; gap: 10px; padding: 6px 14px 9px; background: var(--panel); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--text-ghost); }
.chat-foot a { color: var(--text-dim); }
.chat-foot a:hover { color: var(--gold-hi); }

@media (max-width: 560px) {
  .chat-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border: 0; }
  .chat-launch { right: 14px; bottom: 14px; }
  .chat-launch span { display: none; }
  .chat-launch { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: 0.8; } .chat-body { scroll-behavior: auto; } }
@media print { .chat-launch, .chat-panel, .chat-nudge { display: none !important; } }
