/* ═══════════════════════════════════════════════════════════════
   ATELIER GUIDE — MCP-style chatbot overlay
   Floating launcher + slide-in side panel + tool-call cards
   ═══════════════════════════════════════════════════════════════ */

/* ── LAUNCHER (floating) ───────────────────────────────── */
.gd-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  width: 56px;
  height: 56px;
  background: var(--t1);
  color: var(--bg);
  border: 1px solid var(--t1);
  border-radius: var(--r-c);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: var(--lift);
}
.gd-launcher:hover {
  transform: translateY(-2px);
}
.gd-launcher.open {
  transform: rotate(45deg);
}
.gd-launcher-mark {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.gd-launcher-pip {
  position: absolute;
  top: -3px; right: -3px;
  width: 18px; height: 18px;
  background: var(--fail);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
  border-radius: 50%;
  letter-spacing: 0;
}

/* ── PANEL ─────────────────────────────────────────────── */
.gd-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 460px;
  background: var(--s1);
  border-left: 1px solid var(--b2);
  border-radius: var(--r) 0 0 var(--r);
  z-index: 49;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.gd-panel.open { transform: translateX(0); }

/* HEAD */
.gd-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--b2);
  background: var(--s2);
}
.gd-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gd-brand-mark {
  border-radius: var(--r-m);
  width: 28px;
  height: 28px;
  background: var(--t1);
  color: var(--bg);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
}
.gd-brand-name {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--t1);
}
.gd-brand-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--t3);
}
.gd-close {
  border-radius: var(--r-c);
  background: none;
  border: 1px solid var(--t3);
  color: var(--t2);
  width: 26px;
  height: 26px;
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}
.gd-close:hover {
  background: var(--t1);
  color: var(--bg);
  border-color: var(--t1);
}

.gd-tools-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--b2);
}
.gd-tool-chip {
  border-radius: var(--r-chip);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border: 1px solid var(--b2);
  background: var(--bg);
  color: var(--t2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.gd-tool-chip .dot {
  width: 5px; height: 5px;
  background: var(--mint);
  border-radius: 50%;
}

/* ── CONVERSATION SCROLL ───────────────────────────────── */
.gd-conv {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--t3) transparent;
}
.gd-conv::-webkit-scrollbar { width: 6px; }
.gd-conv::-webkit-scrollbar-thumb { background: var(--t3); }

/* MESSAGE BUBBLES */
.gd-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}
.gd-msg-meta {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--t3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.gd-msg-meta .who { color: var(--t1); font-weight: 600; }
.gd-msg-meta .who.user { color: var(--t2); }

.gd-msg-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--t1);
  text-wrap: pretty;
}
.gd-msg.user .gd-msg-body {
  border-radius: var(--r-c);
  background: var(--t1);
  color: var(--bg);
  padding: 10px 12px;
  align-self: flex-end;
  max-width: 88%;
}
.gd-msg.user { align-items: flex-end; }
.gd-msg.assistant .gd-msg-body {
  padding: 0;
}

/* TOOL CARD (shown above assistant body) */
.gd-tool {
  border-radius: var(--r-c);
  border: 1px solid var(--b2);
  background: var(--s2);
  margin-bottom: 8px;
  overflow: hidden;
}
.gd-tool-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: var(--s3);
  color: var(--t1);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
}
.gd-tool-head .tool-name { font-weight: 700; }
.gd-tool-head .tool-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--mint);
}
.gd-tool-head .tool-status::before {
  content: "";
  width: 5px; height: 5px;
  background: currentColor;
  border-radius: 50%;
  animation: blink 1.4s infinite;
}
.gd-tool-body {
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t2);
}
.gd-tool-args {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  padding: 4px 12px;
  background: color-mix(in srgb, var(--t1) 4%, transparent);
  border-bottom: 1px solid var(--b2);
}
.gd-tool-args .arg-key { color: var(--t2); }
.gd-tool-args .arg-val { color: var(--t1); }

/* TOOL OUTPUT SUB-CARDS */
.gd-card {
  border-radius: var(--r-c);
  border: 1px solid var(--b2);
  background: var(--bg);
  padding: 10px 12px;
  margin-bottom: 6px;
}
.gd-card:last-child { margin-bottom: 0; }
.gd-card.urgent { border-left: 3px solid var(--fail); }
.gd-card.warn   { border-left: 3px solid var(--hold); }

.gd-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.gd-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--t1);
  line-height: 1.3;
}
.gd-card-tag {
  border-radius: var(--r-chip);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  padding: 1px 5px;
  border: 1px solid var(--b2);
  color: var(--t3);
  white-space: nowrap;
}
.gd-card-tag.err { background: var(--fail); color: var(--bg); border-color: var(--fail); }
.gd-card-tag.warn { background: var(--hold); color: var(--bg); border-color: var(--hold); }
.gd-card-tag.ok { background: var(--mint); color: var(--bg); border-color: var(--mint); }

.gd-card-body {
  font-size: 11px;
  color: var(--t2);
  line-height: 1.4;
}
.gd-card-stats {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
}
.gd-card-stats .stat-k { color: var(--t3); letter-spacing: 0.1em; }
.gd-card-stats .stat-v { color: var(--t1); font-weight: 600; }

.gd-card-link {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--t2);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
.gd-card-link:hover { color: var(--t1); }

/* MINI SPARK in card */
.gd-spark {
  width: 100%;
  height: 32px;
  margin-top: 6px;
}
.gd-spark path { stroke: color-mix(in srgb, var(--t1) 72%, transparent); stroke-width: 1.4; fill: none; }
.gd-spark .spark-fill { fill: color-mix(in srgb, var(--t1) 6%, transparent); stroke: none; }

/* ── INPUT BAR ─────────────────────────────────────────── */
.gd-suggest {
  padding: 0 18px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-top: 1px solid var(--b1);
  padding-top: 10px;
}
.gd-sg {
  border-radius: var(--r-chip);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border: 1px solid var(--b2);
  background: var(--bg);
  color: var(--t2);
  cursor: pointer;
}
.gd-sg:hover {
  background: var(--t1);
  color: var(--bg);
  border-color: var(--t1);
}

.gd-input-wrap {
  border-top: 1px solid var(--b2);
  background: var(--bg);
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.gd-input {
  border-radius: var(--r-c);
  flex: 1;
  border: 1px solid var(--b2);
  background: var(--s2);
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--t1);
  resize: none;
  min-height: 38px;
  max-height: 120px;
  line-height: 1.4;
  outline: none;
}
.gd-input:focus {
  border-color: var(--t1);
  background: var(--bg);
}
.gd-input::placeholder {
  color: var(--t3);
  font-style: italic;
}
.gd-send {
  border-radius: var(--r-c);
  background: var(--t1);
  color: var(--bg);
  border: 0;
  padding: 0 14px;
  height: 38px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  align-self: flex-end;
}
.gd-send:hover { background: var(--t2); }
.gd-send:disabled { background: var(--t3); cursor: not-allowed; }

.gd-foot {
  padding: 6px 14px 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--t3);
  display: flex;
  justify-content: space-between;
  background: var(--bg);
  border-top: 1px solid var(--b1);
}
.gd-foot .kbd {
  border-radius: var(--r-chip);
  border: 1px solid var(--b2);
  padding: 0 4px;
  margin: 0 2px;
}

/* TYPING DOTS */
.gd-typing {
  display: inline-flex;
  gap: 4px;
  padding: 8px 0;
}
.gd-typing span {
  width: 6px; height: 6px;
  background: var(--t3);
  border-radius: 50%;
  animation: gd-bounce 1.2s infinite;
}
.gd-typing span:nth-child(2) { animation-delay: 0.15s; }
.gd-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes gd-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-3px); opacity: 1; }
}

/* small screens — make panel cover full width */
@media (max-width: 720px) {
  .gd-panel { width: 100%; border-left: 0; }
}


/* ── THINKING PANEL ────────────────────────────────────── */
.gd-msg-thinking { gap: 6px; }
.gd-msg-thinking .gd-think-status {
  color: var(--t1);
}
.gd-msg-thinking.collapsed .gd-think-status {
  color: var(--t3);
}
.gd-think {
  border-radius: var(--r-c);
  border: 1px solid var(--b2);
  background: color-mix(in srgb, var(--t1) 3%, transparent);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t2);
  overflow: hidden;
  transition: background 0.4s ease, border-color 0.4s ease;
}
.gd-msg-thinking.collapsed .gd-think {
  background: transparent;
  border-color: var(--b1);
}
.gd-think-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: color-mix(in srgb, var(--t1) 6%, transparent);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--t3);
  border-bottom: 1px solid var(--b2);
}
.gd-think-head > span:nth-child(2) { flex: 1; }
.gd-think-spinner {
  width: 8px; height: 8px;
  border: 1.5px solid var(--t3);
  border-top-color: var(--t1);
  border-radius: 50%;
  animation: gd-spin 0.7s linear infinite;
}
.gd-think-spinner.done {
  animation: none;
  border: 0;
  background: var(--mint);
  position: relative;
}
.gd-think-spinner.done::after {
  content: "✓";
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 7px;
  color: var(--bg);
  line-height: 8px;
  font-weight: 700;
}
.gd-think-elapsed {
  font-size: 9px;
  color: var(--t3);
  letter-spacing: 0.05em;
}
@keyframes gd-spin { to { transform: rotate(360deg); } }

.gd-think-steps {
  padding: 6px 10px 8px;
  display: flex;
  flex-direction: column;
}
.gd-think-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 11px;
  color: var(--t2);
  animation: gd-step-in 0.22s ease;
}
@keyframes gd-step-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}
.gd-think-step .step-pip {
  width: 7px; height: 7px;
  border: 1.5px solid var(--t3);
  border-radius: 50%;
  flex-shrink: 0;
}
.gd-think-step.pending .step-pip {
  border-top-color: var(--t1);
  animation: gd-spin 0.7s linear infinite;
}
.gd-think-step.done .step-pip {
  background: var(--mint);
  border-color: var(--mint);
}
.gd-think-step.err .step-pip {
  background: var(--fail);
  border-color: var(--fail);
}
.gd-think-step.pending .step-label { color: var(--t1); }
.gd-think-step.done .step-label    { color: var(--t2); }
.gd-think-step .step-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gd-think-step .step-detail {
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.04em;
}
.gd-think-step.done .step-detail { color: var(--mint); }

/* streaming caret */
.gd-msg-body strong { color: var(--t1); }
.gd-msg-body::after {
  /* default off */
}
