/* Research Copilot.

   Chat-first: one centred reading column with no bubbles, sized for a long
   cited answer. The evidence graph is a companion panel that slides in beside
   it rather than a rail permanently competing for width — a research answer
   with headings, lists and citations is unreadable in 350px. */

/* Flush to the rail and top bar. `.page` padding is for entity pages; here it
   reads as a floating grey card with a white gutter around it.

   The height chain has to be definite from the viewport down. `.shell` is
   only `min-height: 100vh`, so without this the copilot grows with the
   answer, `overflow: hidden` clips it, and `.agentic-thread` never overflows
   — so the wheel has nowhere to scroll. */
html:has(.agentic-app),
html:has(.agentic-app) body {
  height: 100%;
  overflow: hidden;
}

.shell:has(.agentic-app) {
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}

.shell:has(.agentic-app) .shell-main {
  min-height: 0;
  overflow: hidden;
}

.page:has(.agentic-app) {
  padding: 0;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.agentic-app {
  --thread-w: 46rem;
  --canvas-w: 0px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--canvas-w);
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  background: var(--ground);
  transition: grid-template-columns 0.24s ease;
}

.agentic-app.with-canvas {
  --canvas-w: clamp(24rem, 44%, 46rem);
}

/* ============================ Conversation ============================ */

.agentic-chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.agentic-thread {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.agentic-thread-inner {
  width: 100%;
  box-sizing: border-box;
  /* Full height so the welcome state can centre itself vertically; once turns
     exist they simply stack from the top. */
  min-height: 100%;
  margin: 0;
  padding: 2rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Reading column stays centred on the empty state; once a turn exists the
   answer uses the pane, matching the user bubble's right edge. */
.agentic-welcome {
  width: min(var(--thread-w), 100%);
  margin-inline: auto;
}

.agentic-turn.user,
.agentic-turn.assistant {
  width: 100%;
}

/* ------------------------------ Welcome ------------------------------- */

.agentic-welcome {
  margin: auto 0;
  padding: 2.5rem 0 1rem;
}

.agentic-welcome h1 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.agentic-welcome > p {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 34rem;
}

.agentic-suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.6rem;
}

.agentic-suggestions button {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.agentic-suggestions button:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  transform: translateY(-1px);
}

.agentic-suggestions .s-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}

.agentic-suggestions .s-sub {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ------------------------------ Turns --------------------------------- */

.agentic-turn {
  display: flex;
  flex-direction: column;
}

/* The user's own words sit in a soft container aligned right, so the eye can
   find where each exchange starts without a heavy "bubble" frame. */
.agentic-turn.user {
  align-items: flex-end;
}

.agentic-turn.user .agentic-turn-body {
  background: var(--ink);
  color: var(--surface);
  border: 0;
  border-radius: 22px 22px 6px 22px;
  padding: 0.65rem 1.05rem;
  max-width: min(36rem, 85%);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* The answer is the page. No container, no frame — just typography at full
   column width, which is what makes a long cited answer readable. */
.agentic-turn.assistant .agentic-turn-body {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--ink);
}

.agentic-turn.assistant .agentic-turn-body > *:first-child { margin-top: 0; }
.agentic-turn.assistant .agentic-turn-body > *:last-child { margin-bottom: 0; }

.agentic-turn-body h2 {
  font-family: var(--body);
  font-size: 1.22rem;
  font-weight: 700;
  margin: 0.35rem 0 0.7rem;
  letter-spacing: -0.02em;
}

.agentic-turn-body h3 {
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.35rem 0 0.45rem;
}

.agentic-turn-body p { margin: 0 0 0.9rem; }

.agentic-turn-body ul,
.agentic-turn-body ol {
  margin: 0 0 0.95rem;
  padding-left: 1.3rem;
}

.agentic-turn-body li { margin: 0.3rem 0; }

.agentic-turn-body strong { font-weight: 650; }

.agentic-turn-body code {
  font-family: var(--mono);
  font-size: 0.87em;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.agentic-turn-body blockquote {
  margin: 0 0 0.95rem;
  padding: 0.6rem 0.9rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 40%, var(--rule));
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.agentic-turn-body blockquote p:last-child { margin-bottom: 0; }

/* Inline citation markers */
.agentic-cite {
  display: inline-block;
  min-width: 1.05rem;
  text-align: center;
  font-size: 0.68rem;
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.05rem;
  vertical-align: super;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 4px;
  padding: 0 0.2rem;
  text-decoration: none;
  margin: 0 0.05rem;
}

.agentic-cite:hover {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

/* --------------------------- Turn footer ------------------------------ */

.agentic-turn-foot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* Actions stay out of the way until the answer is hovered or focused, so a
   finished answer reads as prose rather than a toolbar. */
.agentic-turn:hover .agentic-turn-foot,
.agentic-turn:focus-within .agentic-turn-foot,
.agentic-turn-foot.is-sticky { opacity: 1; }

.agentic-turn-foot button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.agentic-turn-foot button:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--rule));
}

.agentic-degraded {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  border: 1px dashed var(--rule);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  cursor: help;
}

/* ---------------------------- References ------------------------------ */

.agentic-refs {
  margin-top: 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ground) 55%, var(--surface));
  overflow: hidden;
}

.agentic-refs > summary {
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.agentic-refs > summary::-webkit-details-marker { display: none; }

.agentic-refs > summary::before {
  content: "▸";
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}

.agentic-refs[open] > summary::before { transform: rotate(90deg); }
.agentic-refs > summary:hover { color: var(--ink); }

.agentic-refs-list {
  padding: 0.2rem 0.6rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.agentic-ref {
  display: flex;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  scroll-margin: 1rem;
}

.agentic-ref.is-highlight {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.agentic-ref-n {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  padding-top: 0.1rem;
}

.agentic-ref a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 550;
}

.agentic-ref a:hover { color: var(--accent); text-decoration: underline; }

.agentic-ref-meta {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  margin-top: 0.1rem;
}

/* Web results must not look like peer-reviewed papers. */
.agentic-ref-kind {
  display: inline-block;
  font-size: 0.62rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0 0.25rem;
  margin-right: 0.3rem;
  color: var(--muted);
}

/* ------------------------------ Status -------------------------------- */

.agentic-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.83rem;
  color: var(--muted);
  padding: 0 0.3rem 0.55rem;
}

.agentic-status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  animation: agentic-pulse 1.1s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes agentic-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.75); }
  50%      { opacity: 1;    transform: scale(1); }
}

/* ============================= Composer ============================== */

.agentic-composer {
  flex-shrink: 0;
  padding: 0 0 0.9rem;
  background: linear-gradient(180deg, transparent, var(--ground) 35%);
}

.agentic-composer-inner {
  width: min(var(--thread-w), 100% - 2.5rem);
  margin: 0 auto;
}

.agentic-composer-box {
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: var(--surface);
  padding: 0.6rem 0.7rem 0.5rem;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 5%, transparent);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.agentic-composer-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.agentic-composer-box textarea {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 0.3rem 0.35rem 0.15rem;
  max-height: 12rem;
  overflow-y: auto;
}

.agentic-composer-box textarea::placeholder { color: var(--muted); }

.agentic-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.agentic-tools { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.agentic-composer-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Toggle chips — the checkbox stays real for keyboard and screen readers. */
.agentic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.agentic-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.agentic-chip svg { width: 0.85rem; height: 0.85rem; flex-shrink: 0; }

.agentic-chip:hover { color: var(--ink); border-color: var(--ink); }

.agentic-chip:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
  font-weight: 550;
}

.agentic-chip:has(input:focus-visible) {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.agentic-canvas-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: none;
  cursor: pointer;
}

.agentic-canvas-toggle svg { width: 0.9rem; height: 0.9rem; }
.agentic-canvas-toggle:hover { color: var(--ink); border-color: var(--ink); }

.agentic-canvas-toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}

.agentic-send {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.agentic-send svg { width: 1rem; height: 1rem; }
.agentic-send:hover:not(:disabled) { transform: translateY(-1px); }

.agentic-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.agentic-disclaimer {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ========================== Evidence canvas ========================== */

.agentic-canvas {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--rule);
  background: var(--surface);
  overflow: hidden;
}

.agentic-canvas[hidden] { display: none; }

.agentic-canvas-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem 0.6rem;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.agentic-canvas-head h2 {
  margin: 0.1rem 0 0;
  font-family: var(--display);
  font-size: 1.05rem;
}

.agentic-canvas-close {
  border: 0;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.25rem;
}

.agentic-canvas-close:hover { color: var(--ink); }

.agentic-canvas-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem 0.9rem;
}

.agentic-viewbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ============================ Responsive ============================= */

/* Below the split threshold the canvas overlays the conversation instead of
   halving it — two unreadable columns are worse than one readable one. */
@media (max-width: 1000px) {
  .agentic-app,
  .agentic-app.with-canvas {
    grid-template-columns: minmax(0, 1fr);
  }
  .agentic-canvas {
    position: fixed;
    inset: 0;
    z-index: 60;
    border-left: 0;
  }
}

@media (max-width: 600px) {
  .agentic-thread-inner { padding-inline: 0.75rem; }
  .agentic-composer-inner { width: min(100% - 1.5rem, 100%); }
  .agentic-turn.user .agentic-turn-body { max-width: 92%; }
  .agentic-suggestions { grid-template-columns: 1fr; }
  .agentic-chip span { display: none; }
  .agentic-chip { padding: 0.35rem 0.55rem; }
}

.agentic-overview {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--ground));
  flex-shrink: 0;
}

.agentic-overview h2 {
  margin: 0 0 0.3rem;
  font-size: 0.88rem;
}

.agentic-overview-body {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink);
}

.agentic-overview-body.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agentic-overview-more {
  margin-top: 0.35rem;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
}

.agentic-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.agentic-tab {
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.76rem;
  cursor: pointer;
}

.agentic-tab[aria-selected="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
  font-weight: 600;
}

.agentic-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.76rem;
  color: var(--muted);
  flex-shrink: 0;
}

.agentic-toolbar select,
.agentic-toolbar button {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.76rem;
  padding: 0.28rem 0.5rem;
}

.agentic-stage {
  flex: 1;
  min-height: 280px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 45%),
    var(--ground);
  position: relative;
  overflow: hidden;
}

.agentic-stage-empty {
  padding: 1.5rem 1.25rem;
  max-width: 28rem;
}

.agentic-stage-empty h2 {
  font-family: var(--display);
  margin: 0.2rem 0 0.45rem;
  font-size: 1.1rem;
}

.agentic-stage-canvas {
  width: 100%;
  height: 100%;
  min-height: 280px;
  display: block;
}

.agentic-net-legend {
  position: absolute;
  left: 0.65rem;
  bottom: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--rule);
  font-size: 0.68rem;
  color: var(--muted);
  pointer-events: none;
}

.agentic-net-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.agentic-net-legend i {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  display: inline-block;
}

.agentic-sources {
  display: grid;
  gap: 0.45rem;
}

.agentic-sources:empty::after,
.agentic-sources[data-empty]:empty::after {
  content: attr(data-empty);
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.agentic-source-card {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  background: var(--surface);
  font-size: 0.76rem;
}

.agentic-source-card.is-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.agentic-source-card a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.agentic-source-card a:hover { color: var(--accent); }

.agentic-source-meta {
  margin-top: 0.2rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

/* The sidebar-era detail rules lived here and, being later in the file,
   overrode the slide-over panel defined above. Removed rather than reordered:
   two sets of rules for one component is how the panel ends up styled
   differently depending on which one a future edit happens to find. */

#agentic-detail-body h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0.15rem 0 0.45rem;
}

#agentic-detail-body h3 {
  font-size: 0.78rem;
  margin: 0.75rem 0 0.25rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--mono);
}

.agentic-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.agentic-grid-table th,
.agentic-grid-table td {
  border-bottom: 1px solid var(--rule);
  padding: 0.45rem 0.55rem;
  text-align: left;
}

.agentic-grid-table th { cursor: pointer; color: var(--muted); font-weight: 600; }

.agentic-heatmap {
  display: grid;
  gap: 2px;
  padding: 1rem;
}

.agentic-heatmap-cell {
  min-height: 2rem;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  border-radius: 4px;
  color: var(--ink);
}

.agentic-docs-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem;
  display: grid;
  gap: 0.55rem;
  max-height: 100%;
  overflow: auto;
}

/* Below the two-column threshold the rail stacks under the canvas rather than
   squeezing it: a 300px-wide force-directed graph is not worth keeping. */

/* ==================== Node interaction (two tiers) ==================== */

/* Tier 1: a cursor-following popover — what the node is, how well the
   relationship is evidenced, one headline stat. */
.agentic-popover {
  position: fixed;
  z-index: 70;
  max-width: 20rem;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 16%, transparent);
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

.agentic-popover[hidden] { display: none; }

.agentic-popover h4 {
  margin: 0 0 0.2rem;
  font-size: 0.88rem;
  font-family: var(--display);
}

.agentic-popover-hint {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

/* Tier 2: slides over the canvas so the graph keeps its layout and the
   selected node stays where the reader left it. */
.agentic-detail {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(24rem, 88%);
  z-index: 50;
  background: var(--surface);
  border-left: 1px solid var(--rule);
  box-shadow: -14px 0 40px color-mix(in srgb, var(--ink) 12%, transparent);
  display: flex;
  flex-direction: column;
  animation: agentic-slide-in 0.22s ease;
}

.agentic-detail[hidden] { display: none; }

@keyframes agentic-slide-in {
  from { transform: translateX(14%); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

.agentic-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.agentic-detail-head h2 {
  margin: 0.1rem 0 0;
  font-family: var(--display);
  font-size: 1.05rem;
}

.agentic-detail-close {
  border: 0;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 0.25rem;
}

.agentic-detail-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem 0.9rem 1.1rem;
}

.agentic-detail-body h3 {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-family: var(--mono);
  margin: 1rem 0 0.4rem;
}

/* ======================= Evidence presentation ======================= */

/* Proportional breakdown bar. Rendered only for the curated tier — see
   evidence_card.js for why a co-mention breakdown must not become a bar. */
.agentic-evbar {
  display: flex;
  height: 0.5rem;
  border-radius: 999px;
  overflow: hidden;
  background: var(--rule);
  margin: 0.5rem 0 0.4rem;
}

.agentic-evbar span { display: block; height: 100%; }

.agentic-evlegend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.agentic-evlegend i {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  display: inline-block;
  margin-right: 0.3rem;
}

/* The honesty flag, made visible: curated evidence and a bag of co-mentions
   must not look alike. */
.agentic-tier {
  display: inline-block;
  font-size: 0.68rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid;
  margin-bottom: 0.4rem;
}

.agentic-tier.curated_association {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.agentic-tier.structured_link {
  color: var(--ink);
  border-color: var(--rule);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}

.agentic-tier.co_mention {
  color: var(--muted);
  border-color: var(--rule);
  background: transparent;
  border-style: dashed;
}

.agentic-caveat {
  font-size: 0.76rem;
  color: var(--muted);
  border-left: 2px solid var(--rule);
  padding-left: 0.55rem;
  margin: 0.5rem 0;
}

.agentic-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.7rem 0 0.9rem;
}

.agentic-detail-actions a,
.agentic-detail-actions button {
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.76rem;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
}

.agentic-detail-actions a:hover,
.agentic-detail-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.agentic-evidence-card {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.55rem;
  background: var(--surface);
}

.agentic-evidence-card .src-label {
  font-size: 0.68rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.agentic-evidence-card a {
  display: block;
  font-weight: 600;
  margin: 0.2rem 0 0.3rem;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.35;
}

.agentic-evidence-card a:hover { color: var(--accent); }

.agentic-evidence-card p {
  margin: 0;
  font-size: 0.79rem;
  color: var(--muted);
  line-height: 1.45;
}

.agentic-evidence-card mark {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 0.1rem;
}
