/* ─────────────────────────────────────────────────────────────
   Capraseo — front-page chat thread (mockup)
   Empty state is untouched; everything here only takes effect once
   .chat-active is toggled on .center.center-hero (see js/chat-thread.js).
   The composer center→bottom glide is driven by a FLIP transform in JS;
   this file only owns the resting layouts and the message styling.
   ───────────────────────────────────────────────────────────── */

/* ── Empty state ──────────────────────────────────────────────
   Zero layout footprint so the page is pixel-identical to before. */
.chat-thread { display: none; }

/* ── Active state ─────────────────────────────────────────────
   Restructure the hero column into: (collapsed hero) + scrolling
   thread (flex:1) + docked composer footer. */
.center.center-hero.chat-active {
  justify-content: flex-start;
  gap: 0;
  /* Let the thread + composer span the full stage; the inner content
     stays centered at 1100px (below), so the scrollbar rides the right
     edge instead of floating ~200px in from it. */
  padding-left: 0;
  padding-right: 0;
}

.chat-active .hero {
  max-height: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    max-height 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    margin 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-active .chat-thread {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.chat-active .chat-thread::-webkit-scrollbar { width: 4px; }
.chat-active .chat-thread::-webkit-scrollbar-track { background: transparent; }
.chat-active .chat-thread::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}
.chat-active .chat-thread::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

.chat-thread-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Docked composer — reads as a footer bar across the stage while its
   inner card/chips stay at the original 640px so the FLIP is a clean
   vertical-only glide. overflow:visible keeps the upward model menu
   (css/chat.css:347) from being clipped. */
.chat-active .composer {
  align-self: stretch;
  align-items: center;
  width: 100%;
  padding: 14px 24px 18px;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 11, 0) 0%,
    rgba(10, 10, 11, 0.92) 55%
  );
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  flex-shrink: 0;
  overflow: visible;
}
.chat-active .composer::before { display: none; }
.chat-active .composer > .chatcard,
.chat-active .composer > .chips {
  width: 100%;
  max-width: 1100px;
}

/* In the docked composer the chips sit on the very bottom edge of the
   viewport, so a menu anchored below its chip (css/chat.css:298) drops
   off-screen and can't be seen. The model menu already opens upward
   (css/chat.css:347); mirror that for the skill + MCP menus here.
   max-height keeps a long skill list from running off the top too. */
.chat-active .dropdown[data-dropdown="skill"] .menu,
.chat-active .dropdown[data-dropdown="content-skill"] .menu,
.chat-active .dropdown[data-dropdown="mcp"] .menu {
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateY(4px);
  max-height: min(60vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.chat-active .dropdown[data-dropdown="skill"] .menu::-webkit-scrollbar,
.chat-active .dropdown[data-dropdown="content-skill"] .menu::-webkit-scrollbar,
.chat-active .dropdown[data-dropdown="mcp"] .menu::-webkit-scrollbar {
  width: 4px;
}
.chat-active .dropdown[data-dropdown="skill"] .menu::-webkit-scrollbar-thumb,
.chat-active .dropdown[data-dropdown="content-skill"] .menu::-webkit-scrollbar-thumb,
.chat-active .dropdown[data-dropdown="mcp"] .menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}
.chat-active .dropdown[data-dropdown="skill"] .menu.open,
.chat-active .dropdown[data-dropdown="content-skill"] .menu.open,
.chat-active .dropdown[data-dropdown="mcp"] .menu.open {
  transform: translateY(0);
}

/* ── Messages ─────────────────────────────────────────────────── */
.chat-msg {
  display: flex;
  gap: 12px;
  opacity: 0;
  animation: chatMsgIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.chat-msg.ai { animation-delay: 0.12s; }

@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
}
/* ── Rendered Markdown (assistant replies) ───────────────────────
   The model answers in Markdown; js/chat-thread.js turns it into the
   elements below. Spacing is tuned for a chat bubble (tighter than a
   document) and the bubble's own padding owns the outer gap, so the
   first/last child shed their margins. */
.chat-bubble > :first-child { margin-top: 0; }
.chat-bubble > :last-child { margin-bottom: 0; }
.chat-bubble p { margin: 0.55em 0; }

.chat-bubble h1,
.chat-bubble h2,
.chat-bubble h3,
.chat-bubble h4 {
  margin: 1.15em 0 0.5em;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
}
.chat-bubble h1 { font-size: 1.28em; }
.chat-bubble h2 { font-size: 1.14em; }
.chat-bubble h3 { font-size: 1.02em; }
.chat-bubble h4 { font-size: 0.95em; color: var(--muted); }

.chat-bubble strong { font-weight: 600; }
.chat-bubble em { font-style: italic; }
.chat-bubble del { opacity: 0.6; }
.chat-bubble a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-msg.user .chat-bubble a { color: #053218; }

.chat-bubble ul,
.chat-bubble ol {
  margin: 0.55em 0;
  padding-left: 1.4em;
}
.chat-bubble li { margin: 0.3em 0; }
.chat-bubble li::marker { color: var(--muted); }
.chat-msg.user .chat-bubble li::marker { color: rgba(4, 33, 15, 0.55); }

.chat-bubble hr {
  border: 0;
  border-top: 1px solid var(--line-strong);
  margin: 1.1em 0;
}

.chat-bubble blockquote {
  margin: 0.7em 0;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.chat-bubble blockquote > :first-child { margin-top: 0; }
.chat-bubble blockquote > :last-child { margin-bottom: 0; }

.chat-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}
.chat-bubble pre {
  margin: 0.7em 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}
.chat-bubble pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.84em;
  line-height: 1.5;
}

/* Tables — the divider/scroll wrapper keeps wide tables from
   overflowing the bubble on narrow viewports. */
.chat-bubble .md-table {
  margin: 0.7em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.chat-bubble table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}
.chat-bubble th,
.chat-bubble td {
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.chat-bubble thead th {
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.chat-bubble tbody tr:last-child td { border-bottom: 0; }
.chat-bubble tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* User — iMessage-style: a solid brand-green bubble so the person's
   turn is unmistakable against the AI's neutral reply. Dark green text
   (not white) because #22c55e is bright — this keeps it well above AA. */
.chat-msg.user { justify-content: flex-end; }
.chat-msg.user .chat-bubble {
  max-width: min(74%, 560px);
  background: linear-gradient(180deg, #2ecc6a 0%, #1faa52 100%);
  color: #04210f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 14px 40px -16px rgba(34, 197, 94, 0.45);
}

/* Assistant — the particle goat returns small as the AI avatar */
.chat-msg.ai { justify-content: flex-start; }
.chat-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--accent);
  -webkit-mask: url('/goat_silhouette_mask.png') center / 20px 20px no-repeat;
  mask: url('/goat_silhouette_mask.png') center / 20px 20px no-repeat;
  filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.35));
}
.chat-msg.ai .chat-bubble {
  max-width: min(80%, 760px);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-strong);
}

/* ── AI next-action suggestions, attached under the latest answer ──
   Sits at the bottom of the assistant bubble so it reads as a follow-on
   to what was just said. Only one answer shows these at a time. */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.sug-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease,
    color 0.16s ease, transform 0.16s ease;
}
.sug-btn:hover { transform: translateY(-1px); }
.sug-btn .sug-ico { display: inline-flex; flex-shrink: 0; }
/* Primary green CTA — "Create content". */
.sug-content {
  color: #07140c;
  background: var(--accent);
  border: 1px solid var(--accent);
}
.sug-content:hover { background: #2bd566; border-color: #2bd566; }
/* Live status states of the "Create content" pill once this chat has
   fired off a piece. Generating: muted + spinning icon. Ready: stays
   green (it's now a "View content →" link). Failed: warning tone. */
.sug-content.is-busy {
  color: #07140c;
  background: rgba(46, 204, 113, 0.45);
  border-color: rgba(46, 204, 113, 0.55);
}
.sug-content.is-busy .sug-ico svg {
  animation: sugSpin 0.8s linear infinite;
  transform-origin: 50% 50%;
}
@keyframes sugSpin { to { transform: rotate(360deg); } }
.sug-content.is-failed {
  color: #fff;
  background: #c0392b;
  border-color: #c0392b;
}
.sug-content.is-failed:hover { background: #d2493b; border-color: #d2493b; }
/* Neutral secondary — "Get a backlink". */
.sug-backlink {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-strong);
}
.sug-backlink:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}
.sug-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Embedded data card (AI bubble) ──────────────────────────────
   Reflects "every feature is also context for the AI" — a compact
   glass widget the model can speak to. */
.chat-card {
  margin-top: 12px;
  padding: 14px 16px;
  background: linear-gradient(
    180deg,
    rgba(28, 28, 32, 0.55) 0%,
    rgba(18, 18, 21, 0.62) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.chat-card-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 12px 0;
}
.chat-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}
.chat-stat { display: flex; flex-direction: column; gap: 3px; }
.chat-stat-num {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.chat-stat-num.up { color: var(--accent); }
.chat-stat-label {
  font-size: 11.5px;
  color: var(--muted);
}
.chat-card-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 40px;
  margin-top: 14px;
}
.chat-card-bars i {
  flex: 1;
  display: block;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(
    180deg,
    rgba(34, 197, 94, 0.65),
    rgba(34, 197, 94, 0.12)
  );
}

/* ── Generated content piece (AI bubble) ─────────────────────────
   A content-writer turn isn't prose — it's a finished article. We
   render it as a document-like card inside the bubble so the chat
   reads as a tool that produced content, not a JSON dump. */
.chat-msg.ai .chat-bubble.has-content {
  max-width: min(92%, 820px);
  background: rgba(255, 255, 255, 0.02);
}
.chat-content-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.035) 0%,
    rgba(255, 255, 255, 0.015) 100%
  );
  overflow: hidden;
}
.chat-content-head {
  padding: 14px 18px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-content-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.chat-content-kind::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 7px rgba(34, 197, 94, 0.6);
}
.chat-content-title {
  margin: 8px 0 0 0;
  font-size: 1.22em;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}
/* The article body — semantic HTML from the writer contract. Reading
   styles (h2/h3/p/ul/a) come from the .chat-bubble rules above; here we
   just give it document padding and a comfortable measure. */
.chat-content-body {
  padding: 6px 18px 16px;
  font-size: 0.96em;
  line-height: 1.62;
}
.chat-content-body > :first-child { margin-top: 0.7em; }
.chat-content-body > :last-child { margin-bottom: 0; }
.chat-content-body h1 { font-size: 1.18em; }
.chat-content-body h2 {
  font-size: 1.08em;
  margin-top: 1.3em;
}
.chat-content-body h3 { font-size: 1em; }
.chat-content-foot {
  padding: 12px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.12);
}
.chat-content-open {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.chat-content-open:hover { text-decoration: underline; }
/* The piece this chat created was later deleted from Content — show a
   muted, non-clickable note instead of a link that goes nowhere. */
.chat-content-open.is-deleted {
  color: var(--muted, #8a93a3);
  font-style: italic;
  cursor: default;
}
.chat-content-open.is-deleted::before {
  content: '🗑 ';
  font-style: normal;
}
.chat-content-card.is-deleted { opacity: 0.78; }
/* Mid-stream placeholder while the JSON object is still arriving. */
.chat-content-card.is-writing {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
}
.chat-content-card.is-writing .chat-typing { height: 6px; }

/* ── System-authored user turn (content brief) ───────────────────
   A "user" message that's really the content-writer brief we sent on
   the user's behalf. Rendered as a neutral document card on the user
   side — not the heavy green bubble — so the structured brief (heading,
   keyword table, rationale) stays legible and reads as an attached
   request, not a wall of system text. */
.chat-msg.user.has-brief .chat-bubble {
  max-width: min(90%, 720px);
  padding: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.chat-msg.user.has-brief .chat-bubble a { color: var(--accent); }
.chat-brief-kind {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 18px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-brief-kind::before {
  content: '';
  width: 13px;
  height: 13px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 2h9l5 5v15a0 0 0 0 1 0 0H6a0 0 0 0 1 0 0V2z' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M14 2v6h6M9 13h6M9 17h6' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 2h9l5 5v15a0 0 0 0 1 0 0H6a0 0 0 0 1 0 0V2z' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M14 2v6h6M9 13h6M9 17h6' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chat-brief-body {
  padding: 4px 18px 14px;
  font-size: 13.5px;
}
.chat-brief-body > :first-child { margin-top: 0.6em; }
.chat-brief-body > :last-child { margin-bottom: 0; }
.chat-brief-body h2 { font-size: 1.06em; }
.chat-brief-body h3 {
  font-size: 0.98em;
  color: var(--muted);
}

/* ── Thinking indicator ──────────────────────────────────────────
   Shown in the AI bubble while the model reply is in flight (the
   call is non-streaming, so latency needs to be visible). */
.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 8px;
}
.chat-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: chatTyping 1s ease-in-out infinite;
}
.chat-typing i:nth-child(2) { animation-delay: 0.16s; }
.chat-typing i:nth-child(3) { animation-delay: 0.32s; }

@keyframes chatTyping {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-3px); }
}

/* ── Error bubble ────────────────────────────────────────────────
   A failed turn (no domain in focus, no model, OpenRouter down).
   Reads like an AI reply so the thread stays legible. */
.chat-msg.ai .chat-bubble.is-error {
  background: rgba(225, 75, 74, 0.06);
  border-color: rgba(225, 75, 74, 0.35);
  color: var(--muted);
}

/* Inline "get tokens" link inside a locked (402) error bubble. */
.chat-bubble .chat-get-tokens {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-weight: 500;
  color: var(--gold, #e6c47a);
  text-decoration: none;
}
.chat-bubble .chat-get-tokens:hover { text-decoration: underline; }

/* ── Locked composer (account holds 0 tokens) ────────────────────
   Mirrors the backend pay-to-chat gate: the input/send read as
   disabled until the user buys tokens. */
.composer.composer-locked {
  opacity: 0.6;
}
.composer.composer-locked input,
.composer.composer-locked .send {
  cursor: not-allowed;
}

/* ── "Turn chat into content" submit button ──────────────────────
   The primary action inside the #convert-content-modal. Green pill so it
   reads as the commit step. The :not([hidden]) rule restores the flex
   display the UA sheet removes. */
.task-make:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: center;
  padding: 7px 15px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #7ee29f;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 10px -4px rgba(34, 197, 94, 0.45);
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease,
    box-shadow 160ms ease, transform 120ms ease;
}
.task-make[hidden] { display: none; }
.task-make:hover:not(:disabled) {
  color: #06140c;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 6px 18px -5px rgba(34, 197, 94, 0.65);
}
.task-make:active:not(:disabled) { transform: translateY(1px); }
.task-make:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.task-make.is-busy { opacity: 0.7; cursor: progress; }
.task-make-icon { display: inline-flex; }

/* ── "Convert to content" modal internals ────────────────────────
   The writer-skill + draft-mode dropdowns moved into #convert-content-modal.
   Inside the modal they're promoted from slim chips to full-width form
   controls (matching .field-input) so they read as obvious "pick one here"
   inputs, with the chevron pushed to the right edge. The menu opens downward
   — there's room in the modal, unlike the old composer-docked control. */
#convert-content-modal .cc-dd { display: block; width: 100%; }
#convert-content-modal .cc-dd .chip {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  height: 42px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
}
#convert-content-modal .cc-dd .chip:hover,
#convert-content-modal .cc-dd .chip.open {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(34, 197, 94, 0.5);
  transform: none;
}
#convert-content-modal .cc-dd .chip .chip-label {
  flex: 1;
  max-width: none;
  text-align: left;
  font-size: 14px;
  color: inherit;
}
#convert-content-modal .cc-dd .chip .chip-icon { opacity: 0.85; }
#convert-content-modal .cc-dd .chip .chev { opacity: 0.7; }
/* Full-width dropdown menu, anchored under the control. */
#convert-content-modal .cc-dd .menu { width: 100%; min-width: 0; }
#convert-content-modal .cc-help {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}
#convert-content-modal .cc-help strong { color: rgba(232, 232, 234, 0.85); font-weight: 600; }
#convert-content-modal .cc-link {
  color: #7ee29f;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
#convert-content-modal .cc-link:hover { color: #a8f0c2; text-decoration: underline; }
/* The submit pill shouldn't stretch across the actions row. */
#convert-content-modal .smodal-actions .task-make { flex: 0 0 auto; }

/* ── Task guidebook side drawer ──────────────────────────────────
   Slides in from the right; the chat stays visible behind a light
   click-to-close backdrop. Visual tokens mirror .kw-preview. */
.task-drawer-wrap {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}
.task-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: auto;
}
.task-drawer-wrap.open .task-drawer-backdrop { opacity: 1; }
.task-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 92vw);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(28, 28, 32, 0.98), rgba(18, 18, 21, 0.99));
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -24px 0 60px -20px rgba(0, 0, 0, 0.7);
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
}
.task-drawer-wrap.open .task-drawer { transform: none; }
.task-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.task-drawer-kind {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.task-drawer-head h3 { margin: 4px 0 0; font-size: 16px; font-weight: 600; color: #f3f3f5; }
.task-drawer-x {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  cursor: pointer;
  flex-shrink: 0;
}
.task-drawer-x:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.task-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #d8d8de;
}
.task-drawer-empty { color: var(--muted); font-size: 13px; }
/* Minimal Markdown styling — the .chat-bubble rules are scoped to the
   thread, so the drawer needs its own. */
.task-drawer-body h3 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #a6c8ec;
  margin: 18px 0 6px;
}
.task-drawer-body h3:first-child { margin-top: 0; }
.task-drawer-body h1, .task-drawer-body h2 { font-size: 15px; margin: 16px 0 6px; color: #f3f3f5; }
.task-drawer-body p { margin: 0 0 10px; }
.task-drawer-body ul, .task-drawer-body ol { margin: 0 0 10px; padding-left: 18px; }
.task-drawer-body li { margin: 2px 0; }
.task-drawer-body a { color: #8ab4f8; }
.task-drawer-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
}
.task-drawer-body .md-table table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 0 0 10px; }
.task-drawer-body .md-table th,
.task-drawer-body .md-table td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.task-drawer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 22px 16px;
  border-top: 1px solid var(--line);
}
.task-drawer-foot .task-regen { margin-right: auto; }

.task-regen {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
}
.task-regen:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }

/* Editable draft — the body becomes a contenteditable surface once a
   draft lands, with a faint dashed frame so it reads as editable. */
.task-drawer-hint { margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.task-drawer-body.is-editable {
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  margin: 10px 14px;
  padding: 14px 16px;
}
.task-drawer-body.is-editable:focus { outline: none; border-color: rgba(34, 197, 94, 0.45); }
.task-drawer-body.is-editable:focus-within { border-color: rgba(34, 197, 94, 0.45); }

/* Green primary action — mirrors the .task-make CTA language. */
.task-create {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 8px;
  color: #06140c;
  background: var(--accent);
  border: 1px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 4px 14px -5px rgba(34, 197, 94, 0.6);
  transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease,
    opacity 160ms ease;
}
.task-create:hover:not(:disabled) {
  background: #2fd968;
  box-shadow: 0 6px 18px -5px rgba(34, 197, 94, 0.75);
}
.task-create:active:not(:disabled) { transform: translateY(1px); }
.task-create:disabled {
  cursor: default;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  box-shadow: none;
}
.task-create.is-done {
  color: #7ee29f;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  opacity: 1;
}

/* "View in content" — the green action that takes the place of "Use draft"
   once the task is created. An anchor, so it needs the button chrome. */
.task-view {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.task-view[hidden] { display: none; }
/* Footer "Close" sits to the left (margin-right:auto via .task-regen), so
   "View in content" stays at the far right — exactly where "Use draft" was. */
.task-close-foot[hidden] { display: none; }

/* ── Reduced motion ──────────────────────────────────────────────
   FLIP transform is skipped in JS; here we drop the layout/message
   transitions so the end state appears instantly. */
@media (prefers-reduced-motion: reduce) {
  .chat-active .hero,
  .chat-active .composer { transition: none; }
  .chat-msg { animation: none; opacity: 1; }
  .chat-typing i { animation: none; opacity: 0.5; }
  .task-drawer { transition: none; }
  .task-drawer-backdrop { transition: none; }
}
