/* ═══════════════════════════════════════════
   AGENT DETAIL OVERLAY — shared across pages
   ═══════════════════════════════════════════ */

[data-agent] { cursor: pointer; }
img[data-agent] { transition: filter 0.15s, outline 0.15s; }
img[data-agent]:hover { filter: brightness(1.15); }

.agent-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  /* Sits above every other floater · the composer picker (9001),
     agent-profile drawer (9100/9200), adjourn overlay (9400) all
     should disappear behind this when the user opens an agent intro. */
  z-index: 9700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: var(--mono, "Inter", system-ui, sans-serif);
}
.agent-overlay.open {
  display: flex;
  animation: agent-fade 0.14s ease-out;
}
@keyframes agent-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.agent-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 60px);
  background: var(--panel);
  border: 0.5px solid var(--line-strong);
  color: var(--text);
  animation: agent-rise 0.18s ease-out;
  /* Frame only · the scroll lives in the inner `.agent-card-scroll`
     below. Keeping `.agent-card` a non-scrolling frame means the
     decorative corner brackets (::before / ::after) stay pinned to the
     card's corners instead of anchoring to the scrolled content and
     drifting away. Flex column lets the inner scroller fill the frame
     up to max-height. */
  display: flex;
  flex-direction: column;
}
/* Inner scroll region · owns the overflow + the auto-hide scrollbar
   that used to live on `.agent-card`. Thumb stays transparent until the
   pointer is over the region OR it's actively being scrolled (the
   `.is-scrolling` class is toggled by agent-overlay.js with a short
   trailing timeout). Reserved gutter avoids layout shift on fade-in. */
.agent-card-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  scrollbar-gutter: stable;
  transition: scrollbar-color 0.18s;
}
.agent-card-scroll:hover,
.agent-card-scroll.is-scrolling { scrollbar-color: var(--text-faint) transparent; }
.agent-card-scroll::-webkit-scrollbar { width: 8px; }
.agent-card-scroll::-webkit-scrollbar-track { background: transparent; }
.agent-card-scroll::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
  transition: background 0.18s;
}
.agent-card-scroll:hover::-webkit-scrollbar-thumb,
.agent-card-scroll.is-scrolling::-webkit-scrollbar-thumb { background: var(--text-faint); }
.agent-card-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }
@keyframes agent-rise {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.agent-card::before, .agent-card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--lime);
  pointer-events: none;
}
.agent-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.agent-card::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.agent-classification {
  background: var(--panel-2);
  border-bottom: 0.5px solid var(--line-bright);
  padding: 5px 14px;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lime);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.agent-classification .right { color: var(--text-faint); letter-spacing: 0.12em; }

.agent-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px 14px;
  border-bottom: 0.5px dashed var(--line-bright);
}
.agent-card-avatar {
  width: 72px;
  height: 72px;
  margin: -10px 0 10px;
  display: block;
}
.agent-card-id .name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}
.agent-card-id .role {
  font-size: 10px;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}
.agent-card-id .handle {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 5px;
  letter-spacing: 0.04em;
  font-family: var(--mono);
}
.agent-card-close {
  width: 28px; height: 28px;
  background: transparent;
  border: 0.5px solid var(--line-bright);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  font-family: var(--mono);
  align-self: start;
  transition: all 0.12s;
}
.agent-card-close:hover {
  border-color: var(--lime);
  color: var(--lime);
}

.agent-card-body { padding: 16px 20px 8px; }

.agent-block { margin-bottom: 16px; }
.agent-block-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.agent-block-label::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--lime);
}
.agent-block-label .badge {
  margin-left: auto;
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  font-weight: 600;
  border: 0.5px solid var(--line-bright);
  padding: 1px 6px;
}

.agent-lens {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-soft);
  letter-spacing: -0.003em;
}

/* Model · single-line "Name · Provider" using the same trait-tag
   palette so it sits visually adjacent to the surrounding blocks. */
.agent-model-display {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  letter-spacing: 0.02em;
}
.agent-model-name {
  font-weight: 700;
}
.agent-model-provider {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
  border: 0.5px solid var(--line-bright);
  padding: 2px 7px;
}
.agent-model-provider:empty { display: none; }

/* Editable model picker · the trigger + popover reuse the
   agent-profile model dropdown vocabulary (`.ap-model-trigger` /
   `.ap-model-picker` / `.ap-model-group` / `.ap-model-opt`), defined
   in agent-profile.css so the styles are shared automatically. Both
   stylesheets are loaded on the main app page (see index.html), so
   the classes resolve identically inside the overlay. */
.agent-model-edit[hidden] { display: none; }
/* Lift the `.ap-model-picker` popover above the overlay backdrop ·
   the overlay is z-index 9700; the agent-profile picker default is
   9100, which would sit behind the modal. Scoped modifier class so
   we don't regress the profile-page stacking. */
.ap-model-picker.ap-model-picker-overlay { z-index: 9800; }

.agent-model-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.agent-model-saving {
  color: var(--text-faint);
  letter-spacing: 0.14em;
}
.agent-model-saving[hidden] { display: none; }
.agent-model-error {
  color: var(--red, #B5706A);
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 11px;
  flex-basis: 100%;
}
.agent-model-error[hidden] { display: none; }

/* Kick-from-room block · alert-coloured destructive action. Reads as
   "this will remove someone" from idle state — not just on hover —
   so the user perceives the danger BEFORE they reach for it. Uses
   the project's `--red` token (#B5706A · the same alert tint
   referenced in `.notes-item-unfav` and the brief-llm failure rows)
   so the colour vocabulary matches other destructive surfaces.
   `[data-agent-room-actions][hidden]` gates the block · the overlay
   JS only un-hides it when the agent is kickable
   (in-room + director + non-adjourned). */
.agent-room-actions[hidden] { display: none; }
.agent-kick-btn {
  appearance: none;
  display: block;
  width: 100%;
  background: color-mix(in srgb, var(--red, #B5706A) 6%, transparent);
  border: 0.5px solid color-mix(in srgb, var(--red, #B5706A) 55%, var(--line-bright));
  color: var(--red, #B5706A);
  font-family: var(--mono);
  font-size: 11px;
  /* Weight 400 (was 700) · the alert tint + uppercase letter-spacing
     already carry the "destructive" register; bold on top read as
     shouting. Quieter weight pairs better with the calm overlay
     surface around it. */
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.agent-kick-btn:hover {
  background: color-mix(in srgb, var(--red, #B5706A) 14%, transparent);
  border-color: var(--red, #B5706A);
  /* Bright white text on hover lifts the affordance from "noted
     danger" to "click to commit". */
  color: #FFFFFF;
}
.agent-kick-btn:active { transform: translateY(1px); }
.agent-kick-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

.agent-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.agent-trait {
  border: 0.5px solid var(--line-bright);
  padding: 3px 8px;
  font-size: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  background: rgba(0, 0, 0, 0.2);
}

/* In-room memory · live-notes-style stream of this agent's turns
   in the current room. Each entry: timestamp + tag chip + body.
   Newest entry is highlighted; entries past the 8th fade so the eye
   lands on the most recent. */
.agent-memory-list {
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow-y: auto;
  border: 0.5px solid var(--line-bright);
  background: var(--bg);
  padding: 4px 10px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  scrollbar-gutter: stable;
  transition: scrollbar-color 0.18s;
}
.agent-memory-list:hover,
.agent-memory-list.is-scrolling { scrollbar-color: var(--text-faint) transparent; }
.agent-memory-list::-webkit-scrollbar { width: 6px; }
.agent-memory-list::-webkit-scrollbar-track { background: transparent; }
.agent-memory-list::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
  transition: background 0.18s;
}
.agent-memory-list:hover::-webkit-scrollbar-thumb,
.agent-memory-list.is-scrolling::-webkit-scrollbar-thumb { background: var(--text-faint); }
.agent-memory-list::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }
.agent-note-entry {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 0.5px dotted rgba(255, 255, 255, 0.035);
}
.agent-note-entry:last-child { border-bottom: none; }
.agent-note-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  padding-top: 3px;
}
.agent-note-body {
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-soft);
  letter-spacing: -0.003em;
}
.agent-note-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1px 5px;
  margin-right: 6px;
  vertical-align: 1px;
  border: 0.5px solid var(--line-bright);
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.2);
}
.agent-note-tag.t-obs      { color: var(--text-dim);   border-color: var(--line-bright); }
.agent-note-tag.t-insight  { color: var(--lime);       border-color: var(--lime-deep); }
.agent-note-tag.t-warn     { color: var(--amber);      border-color: var(--amber-dim); }
.agent-note-tag.t-open     { color: var(--text-dim);   border-color: var(--line-bright); }
.agent-note-tag.t-soln     { color: var(--lime);       border-color: var(--lime); background: rgba(111, 181, 114, 0.10); }
.agent-note-tag.t-crux     { color: var(--amber);      border-color: var(--amber); background: rgba(181, 149, 96, 0.10); }
.agent-note-tag.t-origin   { color: var(--text-dim);   border-color: var(--line-bright); }
.agent-note-entry.t-old   .agent-note-body { color: var(--text-dim); }
.agent-note-entry.t-old   .agent-note-time { opacity: 0.55; }
.agent-note-entry.t-fresh { background: linear-gradient(90deg, rgba(111, 181, 114, 0.06), transparent 60%); }
.agent-note-entry.t-fresh .agent-note-body { color: var(--text); }
.agent-note-entry.t-fresh .agent-note-time { color: var(--lime); }

.agent-memory-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 12px;
  text-align: center;
}
.agent-memory-empty .lock-icon {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1;
}
.agent-memory-empty .lock-text {
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-soft);
  letter-spacing: -0.003em;
  max-width: 320px;
}

.agent-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line-bright);
  border: 0.5px solid var(--line-bright);
}
.agent-stat {
  background: var(--panel);
  padding: 9px 10px;
  text-align: center;
}
.agent-stat .v {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--lime);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}
.agent-stat .l {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  margin-top: 4px;
}

.agent-card-foot {
  border-top: 0.5px solid var(--line-bright);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-2);
}
.agent-card-foot .meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.agent-card-foot .meta .lime { color: var(--lime); }
.agent-card-cta {
  text-decoration: none;
  background: var(--lime);
  color: var(--bg);
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 0.5px solid var(--lime);
  cursor: pointer;
  transition: all 0.12s;
}
.agent-card-cta:hover {
  background: transparent;
  color: var(--lime);
}

/* Privacy mode: home / logged-out pages set body[data-agent-mode="public"]
   to hide personal memory + track-record blocks and swap the CTA. */
.agent-overlay .public-only { display: none; }
.agent-overlay.public .private-only { display: none; }
.agent-overlay.public .public-only { display: revert; }

.agent-locked {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 0.5px dashed var(--lime-dim);
  background: rgba(111, 181, 114, 0.04);
}
.agent-locked .lock-icon {
  font-size: 22px;
  color: var(--lime);
  line-height: 1;
}
.agent-locked .lock-text {
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-soft);
  letter-spacing: -0.003em;
}
.agent-locked .lock-link {
  color: var(--lime);
  font-weight: 700;
  text-decoration: none;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  margin-right: 4px;
}
.agent-locked .lock-link:hover { text-decoration: underline; }
.agent-block-label .locked-badge {
  color: var(--text-faint);
  border-color: var(--lime-dim);
}

/* Hide the secondary voice-block sections inside the agent overlay.
   The same renderVoiceBlock() is shared with the full agent-profile
   page (where these stay visible); the overlay is meant to be a
   quick read-only summary, not a place to type a preview line, run
   a multi-minute clone job, or tune speed / pitch / timbre sliders.
   Scope by parent so the profile page is untouched. */
.agent-overlay .ap-voice-section:has(> .ap-voice-forge),
.agent-overlay .ap-voice-section:has(.ap-voice-preview-text),
.agent-overlay .ap-voice-section:has(.ap-voice-emotion-row),
.agent-overlay .ap-voice-section:has(.ap-voice-advanced) { display: none; }

@media (max-width: 600px) {
  .agent-overlay { padding: 12px; }
  .agent-card-head { grid-template-columns: auto 1fr; gap: 12px; padding: 14px 14px 12px; }
  .agent-card-close { grid-column: 1 / -1; justify-self: end; }
  .agent-card-body { padding: 12px 14px 6px; }
  .agent-card-foot { padding: 10px 14px; flex-direction: column; gap: 8px; align-items: stretch; }
  .agent-card-foot .meta { text-align: center; }
}
