/* ============================================================
   Cadry copilot — right-to-left slide-over sidebar.
   Uses the shared design tokens (design.css). Additive: no other
   screen references these classes.
   ============================================================ */

.cop { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.cop > * { pointer-events: auto; }

/* ---- Launcher ---- */
.cop-launch {
  position: fixed; right: 22px; bottom: 22px;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  color: #FFFFFF;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(21, 36, 47, 0.16), 0 8px 28px rgba(21, 36, 47, 0.18);
  transition: transform .16s ease, opacity .16s ease;
}
.cop-launch:hover { transform: translateY(-1px) scale(1.03); }
.cop-launch:active { transform: translateY(0) scale(.96); }
.cop.open .cop-launch { opacity: 0; transform: scale(.9); pointer-events: none; }

/* ---- Panel ----
   A floating card inset from the viewport edges (artboard 08), not a flush
   full-height sheet: rounded 12, full hairline border, popover shadow.
   overflow:clip keeps the square-cornered header/composer inside the radius.
   Closed transform overshoots by the inset + shadow so nothing peeks in. */
.cop-panel {
  position: fixed; top: 16px; right: 16px; bottom: 16px;
  width: clamp(320px, 31vw, 412px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  overflow: clip;
  transform: translateX(calc(100% + 48px));
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
  will-change: transform;
}
.cop.open .cop-panel { transform: translateX(0); }

.cop-head {
  flex: 0 0 auto; min-height: 50px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--rule);
  background: var(--surface);
}
.cop-title { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.cop-spark { color: var(--accent); }
.cop-head-actions { display: flex; align-items: center; gap: 8px; }
.cop-x { width: 26px; padding: 0; justify-content: center; position: relative; }
/* Mono text header actions ("HISTORY" / "NEW"), darkening to ink when active.
   ::before pads each one to a ≥40px hit area without overlapping its neighbor. */
.cop-head-link {
  position: relative; padding: 4px 3px; border-radius: 6px;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  transition: color .14s ease;
}
.cop-head-link:hover, .cop-head-link[aria-expanded="true"] { color: var(--ink); }
.cop-head-link::before { content: ""; position: absolute; inset: -9px -3px; }
.cop-x::before { content: ""; position: absolute; inset: -7px -3px; }

/* ---- Conversation history popover ----
   A 264px card under the header's right side. Rows stack title over a mono
   meta line; the active thread gets a 2px accent left edge + "· Active". */
.cop-history {
  position: absolute; top: 54px; right: 10px; left: auto; z-index: 5;
  width: 264px; max-width: calc(100% - 20px);
  max-height: 58%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--rule-2); border-radius: 10px;
  box-shadow: 0 2px 6px rgba(21, 36, 47, 0.08), 0 12px 32px rgba(21, 36, 47, 0.16);
  scrollbar-width: thin;
}
.cop-history-head {
  position: sticky; top: 0; padding: 9px 12px 7px;
  font-family: var(--mono); font-size: 9px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-4);
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.cop-history-empty {
  margin: 0; padding: 12px;
  font-size: 12.5px; color: var(--ink-3); line-height: 1.5;
}
.cop-history-list { list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 1px; }
.cop-history-item {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  width: 100%; padding: 8px 10px 8px 8px; border-radius: 7px;
  border-left: 2px solid transparent;
  text-align: left; color: var(--ink-2); position: relative;
}
/* Hover/current fill crossfades via opacity (compositor) instead of background
   (paint); the state sets --hi-bg. Text color snaps. */
.cop-history-item::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--hi-bg, var(--hover)); opacity: 0; transition: opacity .12s ease; pointer-events: none; z-index: -1; }
.cop-history-item:hover::after { opacity: 1; }
/* The active thread reads as a flag: square left corners against a solid 2px
   accent edge (the design's navy bar), fog fill behind. */
.cop-history-item.current { color: var(--ink); border-left-color: var(--accent); border-radius: 0 7px 7px 0; --hi-bg: var(--surface-2); }
.cop-history-item.current::after { opacity: 1; }
.cop-history-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-weight: 500;
}
.cop-history-time {
  font-family: var(--mono); font-size: 9px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4);
}

/* ---- Transcript ---- */
.cop-scroll {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
}

.cop-msg { display: flex; max-width: 100%; }
.cop-msg.cop-user { justify-content: flex-end; }
.cop-msg.cop-assistant { justify-content: flex-start; }

.cop-bubble {
  max-width: 86%; padding: 8px 11px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.cop-user .cop-bubble {
  background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid var(--accent-edge); border-bottom-right-radius: 4px;
}
/* Assistant bubble = fog on the white panel, hairline border (artboard 08). */
.cop-assistant .cop-bubble {
  background: var(--bg); color: var(--ink); border: 1px solid var(--rule);
  border-bottom-left-radius: 4px;
}

/* ---- Rendered markdown (assistant bubbles only) ----
   .cop-md is added to an assistant .cop-bubble once it holds rendered HTML.
   It turns OFF the inherited white-space: pre-wrap (which would mangle real
   block spacing) and styles block children for a 13px sidebar, reusing the
   shared design tokens. Code surfaces use --surface so they read against the
   fog (--bg) bubble. */
.cop-bubble.cop-md { white-space: normal; }
.cop-md > :first-child { margin-top: 0; }
.cop-md > :last-child { margin-bottom: 0; }

.cop-md p { margin: 0 0 .5em; }
.cop-md ul, .cop-md ol { margin: 0 0 .5em; padding-left: 1.4em; }
.cop-md li { margin: .15em 0; }
.cop-md li > ul, .cop-md li > ol { margin: .15em 0; }

.cop-md h1, .cop-md h2, .cop-md h3, .cop-md h4 {
  margin: .8em 0 .35em; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em;
}
.cop-md > :first-child h1, .cop-md > h1:first-child { margin-top: 0; }
.cop-md h1 { font-size: 15px; }
.cop-md h2 { font-size: 14px; }
.cop-md h3 { font-size: 13.5px; }
.cop-md h4 { font-size: 13px; color: var(--ink-2); }

.cop-md strong { font-weight: 600; color: var(--ink); }
.cop-md em { font-style: italic; }

.cop-md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.cop-md a:hover { color: var(--accent-ink); }

.cop-md code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: .05em .35em;
}
/* Code blocks scroll horizontally so a long or still-streaming fence never
   blows out the sidebar width. Reset the inline-code chrome inside pre. */
.cop-md pre {
  margin: 0 0 .6em; padding: .6em .7em;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow-x: auto;
  white-space: pre; -webkit-overflow-scrolling: touch;
}
.cop-md pre code {
  background: none; border: 0; border-radius: 0; padding: 0;
  font-size: 12px; line-height: 1.45; color: var(--ink);
}

.cop-md blockquote {
  margin: 0 0 .6em; padding: .1em 0 .1em .7em;
  border-left: 2px solid var(--rule-3); color: var(--ink-3);
}

.cop-md hr { border: 0; border-top: 1px solid var(--rule); margin: .8em 0; }

.cop-md table {
  width: 100%; border-collapse: collapse; margin: 0 0 .6em;
  font-size: 12px; display: block; overflow-x: auto;
}
.cop-md th, .cop-md td { border: 1px solid var(--rule); padding: .3em .5em; text-align: left; }
.cop-md th { background: var(--surface); font-weight: 600; color: var(--ink-2); }

/* Blinking caret trailing the last rendered line while tokens arrive. It sits on
   the LAST block child (marked wraps even a partial line in <p>/<li>/<pre>) so it
   reads inline after the text instead of on its own line below the bubble. The
   controller drops .cop-streaming on finalize/teardown, which removes the caret. */
.cop-md.cop-streaming > :last-child::after {
  content: ""; display: inline-block; width: .5ch; height: 1em;
  background: var(--ink-3); margin-left: 1px; vertical-align: -2px;
  animation: cop-blink 1s steps(2, start) infinite;
}
@keyframes cop-blink { 50% { opacity: 0; } }

/* ---- Tool activity ledger ----
   One chip per tool burst instead of one pill per call. Running: pulsing dot +
   current tool + live count + indeterminate mini bar. Sealed: ✓/✕ + "tool ×N"
   (or "N actions"), expandable to the per-call run log. .single = a lone call,
   which keeps the plain chip (no chevron, nothing to expand). */
.cop-ledger {
  align-self: flex-start; max-width: 86%;
  display: flex; flex-direction: column; align-items: flex-start; min-width: 0;
  --cop-ok-edge: oklch(0.88 0.045 160);
  --cop-bad-edge: oklch(0.90 0.05 25);
}
.cop-ledger.open { width: 86%; }
.cop-ledger-head {
  display: inline-flex; align-items: center; gap: 7px; min-height: 24px;
  padding: 0 9px; border-radius: 12px; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--rule-2); color: var(--ink-3);
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: .03em; text-transform: uppercase;
  position: relative; text-align: left;
  transition: border-radius .2s cubic-bezier(.2, 0, 0, 1), background-color .2s ease, border-color .2s ease, color .2s ease;
}
/* ≥40px hit area for a 24px chip; ±0 horizontally so it never overlaps siblings */
.cop-ledger-head::before { content: ""; position: absolute; inset: -8px 0; }
.cop-ledger.done .cop-ledger-head { background: var(--ok-soft); border-color: var(--cop-ok-edge); color: var(--ok-ink); }
.cop-ledger.error .cop-ledger-head { background: var(--bad-soft); border-color: var(--cop-bad-edge); color: var(--bad-ink); }
.cop-ledger.single .cop-ledger-head { cursor: default; }
.cop-ledger-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cop-ledger.open .cop-ledger-head { width: 100%; border-radius: 10px 10px 0 0; }
.cop-ledger.open .cop-ledger-label { flex: 1 1 auto; }

/* Status glyph: ●/✓/✕ all live stacked in one slot and cross-fade
   (opacity + scale + blur) when the state class flips — never a hard swap. */
.cop-glyph { position: relative; width: 10px; height: 10px; flex: 0 0 auto; }
.cop-g {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 9px; line-height: 1;
  opacity: 0; scale: .25; filter: blur(4px);
  transition: opacity .3s cubic-bezier(.2, 0, 0, 1), scale .3s cubic-bezier(.2, 0, 0, 1), filter .3s cubic-bezier(.2, 0, 0, 1);
}
.cop-g-run::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); animation: cop-pulse 1s ease-in-out infinite;
}
.cop-g-done { color: var(--ok-ink); }
.cop-g-fail { color: var(--bad-ink); }
.cop-ledger.running > .cop-ledger-head .cop-g-run,
.cop-ledger.done > .cop-ledger-head .cop-g-done,
.cop-ledger.error > .cop-ledger-head .cop-g-fail,
.cop-ledger-row.running .cop-g-run,
.cop-ledger-row.done .cop-g-done,
.cop-ledger-row.error .cop-g-fail,
.cop-ledger-row.denied .cop-g-fail { opacity: 1; scale: 1; filter: blur(0); }

/* Indeterminate mini progress bar, running state only */
.cop-ledger-bar {
  width: 48px; height: 3px; border-radius: 2px; flex: 0 0 auto;
  background: var(--rule-2); overflow: hidden; position: relative;
}
.cop-ledger-fill {
  position: absolute; inset: 0; width: 40%; border-radius: 2px;
  background: var(--accent); animation: cop-scan 1.1s cubic-bezier(.4, 0, .6, 1) infinite;
}
@keyframes cop-scan { 0% { translate: -110% 0; } 100% { translate: 280% 0; } }
.cop-ledger:not(.running) .cop-ledger-bar { display: none; }

/* Chevron appears once the burst settles; rotates open. */
.cop-ledger-chev { flex: 0 0 auto; transition: rotate .26s cubic-bezier(.2, 0, 0, 1); }
.cop-ledger.running .cop-ledger-chev, .cop-ledger.single .cop-ledger-chev { display: none; }
.cop-ledger.open .cop-ledger-chev { rotate: 180deg; }

/* Run log: interruptible grid-template-rows expand (no keyframes). */
.cop-ledger-log {
  display: grid; grid-template-rows: 0fr; width: 0; min-width: 100%;
  transition: grid-template-rows .26s cubic-bezier(.2, 0, 0, 1);
}
.cop-ledger.open .cop-ledger-log { grid-template-rows: 1fr; }
.cop-ledger-rows { min-height: 0; overflow: clip; display: flex; flex-direction: column; }
.cop-ledger-row {
  display: flex; align-items: center; gap: 8px; min-height: 26px; padding: 0 11px;
  background: var(--surface);
  border-left: 1px solid var(--rule-2); border-right: 1px solid var(--rule-2);
  font-size: 12px; color: var(--ink-2);
}
.cop-ledger-row + .cop-ledger-row { border-top: 1px solid var(--rule); }
.cop-ledger-row:first-child { border-top: 1px solid var(--rule-2); border-radius: 10px 10px 0 0; margin-top: 4px; }
.cop-ledger-row:last-child { border-bottom: 1px solid var(--rule-2); border-radius: 0 0 10px 10px; }
.cop-ledger.open .cop-ledger-row:first-child { margin-top: -1px; border-top: 0; border-radius: 0; }
.cop-ledger-row-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cop-ledger-row.denied .cop-ledger-row-text, .cop-ledger-row.error .cop-ledger-row-text { color: var(--bad-ink); }

/* The run log's tool-kind lane (artboard 08b): a fixed-width trailing tag
   naming the tool kind — GRID / WEB / CODE — in place of a per-row count slot.
   Only a MIXED burst shows the lane; a same-tool burst's rows stay unlabeled. */
.cop-ledger-row-kind {
  flex: 0 0 auto; width: 34px; text-align: right;
  font-family: var(--mono); font-size: 9px; font-weight: 500;
  letter-spacing: .03em; text-transform: uppercase; color: var(--ink-4);
  display: none;
}
.cop-ledger.mixed .cop-ledger-row-kind { display: block; }

@keyframes cop-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ---- Sources row (artboard 08b) ----
   Citations under a cited reply: a quiet mono SOURCES label + white domain
   pills (accent dot + domain), first three + "+N" overflow. Pills are links —
   new tab, title = the cited page. Chips stagger in ~60ms apiece (the JS sets
   animation-delay); hydrated transcripts render them static. */
.cop-sources {
  align-self: flex-start; max-width: 86%;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: -5px; padding-left: 2px;
}
.cop-sources-label, .cop-sources-more {
  font-family: var(--mono); font-size: 9px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4);
  flex: 0 0 auto;
}
/* "+N" is a button: a dashed pill that expands the hidden pills in place. */
.cop-sources-more {
  letter-spacing: 0; height: 18px; padding: 0 7px;
  border: 1px dashed var(--rule-3); border-radius: 9px;
  transition: border-color .14s ease, color .14s ease;
}
.cop-sources-more:hover { border-color: var(--accent); color: var(--ink-2); }
.cop-source.cop-source-hidden { display: none; }
.cop-source {
  display: inline-flex; align-items: center; gap: 5px;
  height: 18px; padding: 0 8px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--rule-2);
  text-decoration: none;
  transition: border-color .14s ease;
}
.cop-source:hover { border-color: var(--rule-3); }
.cop-source-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.cop-source-domain {
  font-family: var(--mono); font-size: 9px; font-weight: 500; color: var(--ink-3);
  max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- Inline cited spans (artboard 08b: citations live where the claim is) ----
   A cited span gets a quiet dashed underline; hover raises the source card
   (below); click opens the first source. */
.cop-cited {
  position: relative; cursor: pointer;
  text-decoration: underline dashed 1px;
  text-decoration-color: color-mix(in oklab, var(--accent) 55%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color .14s ease, background-color .14s ease;
}
.cop-cited:hover { text-decoration-color: var(--accent); background: var(--accent-soft); }

/* ---- Hover cards (source card + whisper popover) ----
   Appended INSIDE their anchor (so hover containment is free), floated below
   it. ~150ms hover intent is handled in JS; the appearance is a 120ms fade. */
.cop-card {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 6;
  background: var(--surface); border: 1px solid var(--rule-2); border-radius: 8px;
  box-shadow: 0 2px 6px rgba(21, 36, 47, 0.08), 0 10px 28px rgba(21, 36, 47, 0.14);
  animation: cop-card-in .12s ease backwards;
  font-family: var(--sans); font-size: 12px; font-weight: 400;
  letter-spacing: 0; text-transform: none; white-space: normal;
  text-decoration: none; cursor: default;
}
@keyframes cop-card-in { from { opacity: 0; translate: 0 2px; } }

.cop-source-card { display: flex; flex-direction: column; padding: 4px; min-width: 220px; max-width: 300px; }
/* The card can live inside a .cop-md bubble — shield it from the link styles. */
.cop-md .cop-source-card-row, .cop-source-card-row {
  display: flex; align-items: center; gap: 7px; min-height: 26px;
  padding: 0 7px; border-radius: 6px; color: var(--ink-4); min-width: 0;
  text-decoration: none;
}
.cop-source-card-row .cop-source-domain { flex: 0 0 auto; }
.cop-source-card-row:hover { background: var(--hover); }
.cop-source-card-title {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11.5px; color: var(--ink-2);
}
.cop-source-card-row svg { flex: 0 0 auto; }

/* ---- Memory whisper (artboard 08b) ----
   A memory write is never a ledger chip: a borderless "✦ REMEMBERED · note"
   whisper fades in under the reply (~200ms after it settles — the JS sets the
   delay). The inline note is the digest; hover raises a popover with the full
   saved note, its path, and FORGET. */
.cop-whisper {
  align-self: flex-start; max-width: 100%; position: relative;
  display: flex; align-items: center; gap: 7px; padding-left: 2px;
}
.cop-whisper-mark { color: var(--accent); font-family: var(--mono); font-size: 10px; line-height: 1; flex: 0 0 auto; }
.cop-whisper-label {
  font-family: var(--mono); font-size: 9px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4);
  flex: 0 0 auto;
}
.cop-whisper-note {
  font-size: 12px; color: var(--ink-3); line-height: 1.25;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.cop-whisper-card {
  left: 16px; display: flex; flex-direction: column; gap: 6px;
  width: 290px; max-width: 84vw; padding: 9px 11px 8px;
}
.cop-whisper-card-note { font-size: 11.5px; line-height: 16px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.cop-whisper-card-foot { display: flex; align-items: center; gap: 8px; }
.cop-whisper-card-path {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 8.5px; font-weight: 500; color: var(--ink-4);
}
.cop-whisper-forget {
  font-family: var(--mono); font-size: 9px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--bad-ink);
  padding: 2px 3px; border-radius: 4px; flex: 0 0 auto; position: relative;
}
.cop-whisper-forget:hover { background: var(--bad-soft); }
.cop-whisper-forget::before { content: ""; position: absolute; inset: -8px -4px; } /* ≥24px hit area for a 9px word */

/* ---- Enter/exit motion ----
   .cop-in is added ONLY to live-appended turns (never hydrated transcripts), so
   nothing animates on load. Exits (.cop-out) are softer than enters. */
.cop-in { animation: cop-enter .26s cubic-bezier(.2, 0, 0, 1) backwards; }
@keyframes cop-enter { from { opacity: 0; translate: 0 5px; } }
.cop-out { opacity: 0; translate: 0 4px; transition: opacity .18s ease, translate .18s ease; pointer-events: none; }

/* ---- Thinking dots ---- */
.cop-thinking { align-self: flex-start; display: inline-flex; gap: 4px; padding: 9px 12px; }
.cop-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); animation: cop-bounce 1.2s ease-in-out infinite; }
.cop-dot:nth-child(2) { animation-delay: .15s; }
.cop-dot:nth-child(3) { animation-delay: .3s; }
@keyframes cop-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ---- Confirm card ----
   Amber soft fill with a soft amber edge (#E5D4B0 per artboard 08), not the
   full-strength warn border. */
.cop-confirm {
  align-self: stretch; border: 1px solid #E5D4B0;
  background: var(--warn-soft); border-radius: var(--radius-lg);
  padding: 11px 12px; display: flex; flex-direction: column; gap: 8px;
}
.cop-confirm-head { font-weight: 600; font-size: 12.5px; color: var(--warn-ink); }
.cop-confirm-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--ink-2); }
.cop-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Error line ---- */
.cop-error {
  align-self: stretch; font-size: 12.5px; color: var(--bad-ink);
  background: var(--bad-soft); border: 1px solid var(--bad-soft);
  border-radius: var(--radius); padding: 8px 10px;
}

/* ---- Empty state ("where NEW lands") ----
   Centered brand roundel + serif greeting + suggestion prompt cards that seed
   the composer. The blank-workspace welcome is this same state, full-page. */
.cop-empty { margin: auto 0; text-align: center; padding: 18px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cop-empty-mark {
  width: 44px; height: 44px; border-radius: 50%; margin-bottom: 8px;
  display: grid; place-items: center; color: #FFFFFF;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(21, 36, 47, 0.16), 0 8px 28px rgba(21, 36, 47, 0.18);
}
.cop-empty-title { font-family: var(--serif); font-weight: 500; font-size: 20px; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.cop-empty-sub { font-size: 13px; color: var(--ink-3); margin: 0; max-width: 32ch; line-height: 1.5; text-wrap: pretty; }
.cop-suggest { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; width: 100%; max-width: 300px; }
.cop-chip-suggest {
  text-align: left; font-size: 13px; color: var(--ink-2); line-height: 1.3;
  padding: 11px 13px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--rule-2); box-shadow: var(--shadow-1);
  position: relative;
  transition: scale .14s cubic-bezier(.2, 0, 0, 1), border-color .14s ease;
}
/* Hover tint via opacity crossfade (compositor) instead of background (paint). */
.cop-chip-suggest::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--surface-2); opacity: 0; transition: opacity .12s ease; pointer-events: none; z-index: -1; }
.cop-chip-suggest:hover::after { opacity: 1; }
.cop-chip-suggest:hover { border-color: var(--rule-3); }
.cop-chip-suggest:active { scale: .96; }

/* ---- Composer ---- */
.cop-composer {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px;
  padding: 10px 16px 12px; border-top: 1px solid var(--rule); background: var(--surface);
}
.cop-composer-row { display: flex; align-items: flex-end; gap: 8px; }
.cop-composer textarea {
  flex: 1 1 auto; resize: none; max-height: 140px;
  padding: 10px 13px; border-radius: 10px; border: 1px solid var(--rule-2);
  background: var(--bg); font-size: 13px; line-height: 1.45; color: var(--ink);
  font-family: var(--sans);
}
.cop-composer textarea::placeholder { color: var(--ink-4); }
.cop-composer textarea:focus { outline: none; border-color: var(--accent-edge); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.cop-composer textarea:disabled { opacity: .6; cursor: not-allowed; }
.cop-send {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; color: #FFFFFF; background: var(--accent);
  position: relative; transition: transform .1s;
}
/* Hover darken crossfades via opacity (compositor) instead of background (paint);
   the press scale stays S-tier transform. */
.cop-send::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: #000; opacity: 0; transition: opacity .12s ease; pointer-events: none; z-index: -1; }
.cop-send:hover::after { opacity: 1; }
.cop-send:active { transform: scale(.96); }
.cop.busy .cop-send { opacity: .5; pointer-events: none; }

/* ---- Attachments (artboard 08c) ----
   Files stage as manifest chips in a tray above the textarea, the whole panel
   is the drop target, and sent files ride as tags atop the user bubble. */
.cop-attach {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; color: var(--ink-3);
  background: var(--surface); border: 1px solid var(--rule-2);
  transition: color .14s ease, border-color .14s ease, transform .1s;
}
.cop-attach:hover { color: var(--ink); border-color: var(--rule-3); }
.cop-attach:active { transform: scale(.96); }
.cop.busy .cop-attach, .cop-welcome.busy .cop-attach { opacity: .5; pointer-events: none; }

.cop-tray { display: flex; flex-wrap: wrap; gap: 6px; }
/* Chip radius math is concentric: chip 8 = thumb 5 + 3px pad. */
.cop-chip {
  display: flex; align-items: center; gap: 7px; height: 36px;
  padding: 4px 6px 4px 4px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--rule-2);
  max-width: 100%;
}
.cop-chip-thumb {
  width: 28px; height: 28px; border-radius: 5px; object-fit: cover; flex: 0 0 auto;
  outline: 1px solid rgba(0, 0, 0, 0.1); outline-offset: -1px;
}
.cop-chip-glyph { color: var(--ink-4); flex: 0 0 auto; margin-left: 4px; }
.cop-chip-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cop-chip-name {
  font-size: 11px; font-weight: 500; line-height: 13px; color: var(--ink-2);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cop-chip-size {
  font-family: var(--mono); font-size: 9px; font-weight: 500; line-height: 11px;
  color: var(--ink-4); font-variant-numeric: tabular-nums;
}
/* The × is 18px visually but carries a ≥40px hit area via ::before. */
.cop-chip-x {
  position: relative; width: 18px; height: 18px; border-radius: 5px;
  display: grid; place-items: center; color: var(--ink-4); flex: 0 0 auto;
  transition: color .14s ease, transform .1s;
}
.cop-chip-x::before { content: ""; position: absolute; inset: -11px; }
.cop-chip-x:hover { color: var(--ink); }
.cop-chip-x:active { transform: scale(.96); }
.cop-chip-error {
  height: auto; min-height: 28px; padding: 5px 10px;
  background: oklch(0.96 0.02 25); border-color: oklch(0.86 0.05 25);
  color: oklch(0.42 0.12 25); font-size: 11px; font-weight: 500; line-height: 14px;
}

/* Drop scrim: the whole panel is the target. The dashed inset is concentric
   with the panel (panel 12 − 6px inset ≈ 8). Fades on opacity only. */
.cop-drop {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .16s ease;
}
.cop.dragging .cop-drop, .cop-welcome.dragging .cop-drop { opacity: 1; transition-duration: .12s; }
.cop-drop-zone {
  position: absolute; inset: 6px; border-radius: 8px;
  border: 1.5px dashed var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.cop-drop-mark {
  width: 44px; height: 44px; border-radius: 12px; color: var(--accent);
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--rule-2); box-shadow: var(--shadow-pop);
}
.cop-drop-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.cop-drop-sub {
  font-family: var(--mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .1em; color: var(--ink-3); text-transform: uppercase;
}

/* Sent cargo: compact tags flush above the user bubble, in its tint family. */
.cop-msg:has(.cop-files) { flex-direction: column; align-items: flex-end; gap: 5px; }
.cop-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.cop-file {
  display: flex; align-items: center; gap: 6px; height: 28px;
  padding: 3px 8px 3px 3px; border-radius: 7px;
  background: var(--accent-soft); border: 1px solid var(--accent-edge);
}
.cop-file-thumb {
  width: 22px; height: 22px; border-radius: 5px; object-fit: cover; flex: 0 0 auto;
  outline: 1px solid rgba(0, 0, 0, 0.1); outline-offset: -1px;
}
.cop-file-glyph { color: var(--accent-ink); flex: 0 0 auto; margin-left: 4px; }
.cop-file-name {
  font-size: 10.5px; font-weight: 500; line-height: 13px; color: var(--accent-ink);
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- Mobile ----
   The floating card goes back to a full-bleed sheet. */
@media (max-width: 640px) {
  .cop-panel { width: 100vw; top: 0; right: 0; bottom: 0; border-radius: 0; border: 0; }
  .cop-launch { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .cop-panel, .cop-ledger-log, .cop-ledger-chev, .cop-g, .cop-ledger-head, .cop-drop { transition: none; }
  .cop-dot, .cop-g-run::before, .cop-ledger-fill, .cop-in, .cop-card,
  .cop-md.cop-streaming > :last-child::after { animation: none; }
}
