/* ============================================================
   AvidCreation chat-viewer.css
   Light theme · conversation blocks · FVW v5.2 friendly
   Reusable: drop this file into any project, point it at a JSON
   manifest, get the same chat-style prompt archive.
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  background: #fafaf9;
  color: #1c1917;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ----- Header ----- */
.site-header { padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid #e7e5e4; }
.site-header .header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.site-header h1 { font-size: 28px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; color: #1c1917; }
.site-header .tagline { font-size: 15px; color: #57534e; margin: 0 0 10px; }
.site-header .meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: #78716c; }
.site-header .meta strong { color: #1c1917; font-weight: 600; }

.timeline-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #d6d3d1;
  color: #1c1917;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
}
.timeline-button:hover { background: #f5f5f4; border-color: #a8a29e; }
.timeline-button.active { background: #1c1917; color: #fafaf9; border-color: #1c1917; }
.timeline-icon { font-size: 16px; }
.timeline-count {
  background: #e7e5e4;
  color: #57534e;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}
.timeline-button.active .timeline-count { background: rgba(255,255,255,0.2); color: #fafaf9; }

/* ----- Search bar (top of page, above project picker) ----- */
.search-bar-top {
  position: relative;
  margin-bottom: 18px;
}
.search-bar-top input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  font-size: 16px;
  font-family: inherit;
  background: #ffffff;
  border: 1px solid #d6d3d1;
  border-radius: 10px;
  color: #1c1917;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.search-bar-top input:focus {
  border-color: #2d4a7c;
  box-shadow: 0 0 0 3px rgba(45, 74, 124, 0.12);
}
.search-bar-top input::placeholder { color: #78716c; }
.search-bar-top::before {
  content: "🔍";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
}
.search-bar-top .clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #78716c; font-size: 18px;
  cursor: pointer; padding: 4px 8px; display: none;
}
.search-bar-top.has-text .clear { display: block; }
.search-bar-top .search-hint {
  font-size: 11px;
  color: #78716c;
  margin-top: 6px;
  padding: 0 4px;
}
.search-bar-top .search-hint .search-match-count { color: #1c1917; font-weight: 600; }

.search-results-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #d6d3d1;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  z-index: 40; /* below the anchor panel (z-index: 60) so the panel stays on top when both are open */
  display: none;
  max-height: 60vh;
  overflow-y: auto;
}
.search-results-panel.open { display: block; }
.search-results-panel .result-group {
  border-bottom: 1px solid #f5f5f4;
}
.search-results-panel .result-group:last-child { border-bottom: none; }
.search-results-panel .result-group-header {
  padding: 8px 14px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: #78716c;
  background: #fafaf9;
}
.search-results-panel .result-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: background 0.1s;
}
.search-results-panel .result-item:hover { background: #f5f5f4; }
.search-results-panel .result-item .result-title {
  font-size: 13px;
  color: #1c1917;
  font-weight: 500;
  line-height: 1.3;
}
.search-results-panel .result-item .result-meta {
  font-size: 11px;
  color: #78716c;
  margin-top: 2px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.search-results-panel .result-item .result-snippet {
  font-size: 12px;
  color: #57534e;
  margin-top: 2px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-results-panel .result-empty {
  padding: 20px 14px;
  color: #78716c;
  font-size: 13px;
  text-align: center;
  font-style: italic;
}

.project-chips, .tag-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 12px;
  align-items: center;
}
.chip-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #78716c; font-weight: 600; margin-right: 4px;
}
.chip {
  background: #ffffff;
  border: 1px solid #d6d3d1;
  color: #44403c;
  font-size: 13px; font-family: inherit;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
}
.chip:hover { background: #f5f5f4; border-color: #a8a29e; }
.chip.active {
  background: #1c1917; color: #fafaf9; border-color: #1c1917; font-weight: 500;
}
.chip .count { margin-left: 4px; opacity: 0.6; font-size: 11px; }
.chip.active .count { opacity: 0.9; }
.chip-more { border-style: dashed; color: #57534e; font-style: italic; }
.chip-more:hover { background: #f5f5f4; border-color: #78716c; }

/* Pinned active tags (per operator 2026-06-11 18:15: clicked tags must show
   in the visible cloud, not just in the popover). Pinned tags live in a small
   row above the top-12 most-used tags. */
.chip-pinned-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-right: 8px;
  padding-right: 8px;
  border-right: 1px solid #e7e5e4;
}
.chip-pinned-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #2d4a7c;
  font-weight: 600;
  margin-right: 2px;
}
.chip-pinned-row .chip {
  /* Pinned chips are visually distinct from regular top-12 chips */
  background: #e0e7ff;
  border-color: #c7d2fe;
  color: #1e3a8a;
}
.chip-pinned-row .chip:hover {
  background: #c7d2fe;
  border-color: #2d4a7c;
}

/* Tag popover (Notion/Linear-style dropdown for "+ N more") */
/* ============================================================
   Chip-nav (pact/platform/chip-system/chip-system.md)
   Top-level chip-nav. Used by: main page project row, anchor-panel project row.
   Rules: overflow flyout (not modal), drag-to-reorder, one-word labels,
   active state via var(--accent), 150ms ease-out transitions.
   ============================================================ */

:root {
  --accent: #1c1917;       /* dark; same as .chip.active background */
  --chip-fav-bg: #fdf2d8;
  --chip-fav-border: #f6c971;
  --chip-fav-text: #7c5a09;
}

.chip-nav {
  display: flex; align-items: center;
  position: relative;
  min-width: 0;
  flex: 1;
}
.chip-nav-inner {
  display: flex; align-items: center;
  flex-wrap: nowrap;       /* overflow flyout is the only escape valve */
  gap: 6px;
  flex: 1; min-width: 0;
  overflow: hidden;
}
.chip {
  /* Per pact: drag-to-reorder, 150ms ease-out */
  transition: background-color 150ms ease-out, border-color 150ms ease-out,
              color 150ms ease-out, transform 150ms ease-out,
              box-shadow 150ms ease-out;
  flex: 0 0 auto;
}
.chip.dragging { opacity: 0.45; cursor: grabbing; }
.chip.drop-target {
  box-shadow: -3px 0 0 0 var(--accent);
  background: #fafaf9;
}
.chip-overflow {
  border-style: dashed;
  color: #57534e;
  font-weight: 500;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.chip-overflow:hover { background: #f5f5f4; border-color: #78716c; }

/* Favourites chip — warm background per operator 2026-06-11 19:21 */
.chip-fav {
  background: var(--chip-fav-bg);
  border-color: var(--chip-fav-border);
  color: var(--chip-fav-text);
}
.chip-fav.active { background: #fde68a; border-color: #b45309; color: #5a3703; }
.chip-fav-heart { color: #b45309; margin-right: 3px; }

/* Project flyout (overflow) — anchored popover (per pact: "flyout", not modal).
   One flyout at a time; closes on outside click or after chip action. */
.project-flyout {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px;
  min-width: 180px; max-width: 280px;
  background: #ffffff;
  border: 1px solid #d6d3d1;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  z-index: 300;
  font-family: inherit;
}
.project-flyout .chip { width: 100%; justify-content: flex-start; text-align: left; }

/* Long-press hint: when a chip is being held, lift it slightly. */
.chip:active { transform: translateY(1px); }

/* ============================================================
   Sub-chips (pact/platform/cards/sub-chip.md)
   Report Card sub-chip switcher. Used by: Mavis response bubble, Report Card.
   Rules: single-active, instant peek update, context highlight,
   never creates/elevates, never appears in panels.
   ============================================================ */

.rc-sub-chips {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px dashed #e7e5e4;
  border-bottom: 1px dashed #e7e5e4;
  background: #fafaf9;
}
.rc-sub-chip {
  background: #ffffff;
  border: 1px solid #d6d3d1;
  color: #57534e;          /* muted when inactive */
  font-size: 12px; font-family: inherit;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 150ms ease-out, color 150ms ease-out,
              border-color 150ms ease-out, font-weight 150ms ease-out;
  user-select: none;
}
.rc-sub-chip:hover { background: #f5f5f4; }
.rc-sub-chip.active {
  background: var(--accent);
  color: #fafaf9;
  border-color: var(--accent);
  font-weight: 600;        /* highlighted (per sub-chip.context-highlight.001) */
}
.tag-popover {
  position: fixed;
  z-index: 200;
  width: 320px;
  max-height: 60vh;
  background: #ffffff;
  border: 1px solid #d6d3d1;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}
.tag-popover.open { display: flex; }
.tag-popover-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid #e7e5e4;
  background: #fafaf9;
}
.tag-popover-search {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: #1c1917;
  padding: 4px 6px;
  outline: none;
}
.tag-popover-search::placeholder { color: #78716c; }
.tag-popover-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #78716c;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.tag-popover-close:hover { color: #1c1917; }
.tag-popover-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}
.tag-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 14px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: #1c1917;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}
.tag-popover-item:hover { background: #f5f5f4; }
.tag-popover-item.active { background: #e0e7ff; }
.tag-popover-name { flex: 1; }
.tag-popover-count {
  font-size: 11px;
  color: #78716c;
  background: #f5f5f4;
  padding: 1px 7px;
  border-radius: 999px;
}
.tag-popover-check { color: #2d4a7c; font-weight: 600; }
.tag-popover-empty {
  padding: 20px 14px;
  color: #78716c;
  font-size: 12px;
  text-align: center;
  font-style: italic;
}
/* Topics section (above the tag list in the popover) */
.tag-popover-topics { display: none; padding: 8px 12px 10px; border-bottom: 1px solid #e7e5e4; }
.topic-section-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #78716c;
  margin-bottom: 6px;
}
.topic-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-topic {
  background: #e0e7ff;
  border-color: #c7d2fe;
  color: #1e3a8a;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chip-topic:hover { background: #c7d2fe; }
.chip-topic-name { font-weight: 500; }
.chip-topic-count {
  font-size: 10px;
  background: rgba(45, 74, 124, 0.12);
  color: #1e3a8a;
  padding: 0 5px;
  border-radius: 999px;
}

/* Thread row in the Report Card back (above sub-chips) */
.rc-thread-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 8px;
  border-bottom: 1px dashed #e7e5e4;
  margin-bottom: 8px;
}
.rc-sub-chip-thread {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #14532d;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.rc-sub-chip-thread:hover { background: #dcfce7; }
.rc-sub-chip-thread .rc-sub-chip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  font-weight: 600;
}
.rc-sub-chip-thread .rc-sub-chip-value {
  font-weight: 500;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-bar { position: relative; margin-top: 8px; }
.search-bar input {
  width: 100%; padding: 10px 14px 10px 38px; font-size: 15px; font-family: inherit;
  background: #ffffff; border: 1px solid #d6d3d1; border-radius: 8px;
  color: #1c1917; outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.search-bar input:focus { border-color: #2d4a7c; box-shadow: 0 0 0 3px rgba(45, 74, 124, 0.12); }
.search-bar::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: 0.5; }
.search-bar .clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #78716c; font-size: 18px;
  cursor: pointer; padding: 4px 8px; display: none;
}
.search-bar.has-text .clear { display: block; }

/* ----- Main layout (conversation + anchor rail) ----- */
.main {
  position: relative;
  display: flex;
  gap: 32px;
}
.conversation-list {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ----- Conversation block ----- */
.chat-block {
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  overflow: hidden;
  scroll-margin-top: 20px; /* for anchor rail scroll-to */
}
.chat-block .meta-strip {
  padding: 10px 16px;
  font-size: 12px;
  color: #57534e;
  background: #fafaf9;
  border-bottom: 1px solid #e7e5e4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.chat-block .meta-strip .project-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-family: inherit;
}
.project-badge.freshvibe { background: #dcfce7; color: #166534; }
.project-badge.freshcards { background: #dbeafe; color: #1e40af; }
.project-badge.smartpantry { background: #fef3c7; color: #92400e; }
.project-badge.freshvibeui { background: #f3e8ff; color: #6b21a8; }
.project-badge.home-studio { background: #fce7f3; color: #9d174d; }
.project-badge.default { background: #e7e5e4; color: #44403c; }
.chat-block .meta-strip .slug { font-weight: 600; color: #1c1917; }
.chat-block .meta-strip .timestamp { opacity: 0.7; }

.bubble-row {
  display: flex;
  margin: 14px 0;
  padding: 0 16px;
}
.bubble-row.operator { justify-content: flex-start; }
.bubble-row.mavis { justify-content: flex-end; }

.bubble {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  position: relative;
  word-wrap: break-word;
}
.bubble.operator {
  background: #e0e7ff; /* very light blue */
  color: #1e1b4b;
  border-bottom-left-radius: 4px;
  border: 1px solid #c7d2fe;
}
.bubble.mavis {
  background: #f5f5f4; /* neutral surface */
  color: #1c1917;
  border-bottom-right-radius: 4px;
  border: 1px solid #e7e5e4;
}
.bubble .bubble-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.7;
}
.bubble .bubble-title {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 6px;
  color: #1c1917;
}
.bubble .bubble-body {
  font-size: 14px;
  line-height: 1.6;
}
.bubble .bubble-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.bubble .bubble-toggle {
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(0,0,0,0.08);
  font-size: 12px;
  font-family: inherit;
  color: #44403c;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.bubble .bubble-toggle:hover { background: rgba(255,255,255,0.9); }
.bubble .card-back { display: none; }
.bubble.expanded .card-back { display: block; }
.bubble .card-back.report-card {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0,0,0,0.12);
  /* Report card visual style per cards.visual.report.001:
     "Smaller front region (just title + summary), larger back region" */
}

/* Sub-chips row — the switcher (no info bar, no support-acts per operator refinement) */
.bubble .rc-sub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.bubble .rc-sub-chip {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.12);
  color: #44403c;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s;
}
.bubble .rc-sub-chip:hover { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.2); }
.bubble .rc-sub-chip.active { background: #1c1917; color: #fafaf9; border-color: #1c1917; }

/* Sub-chip panel area (one panel per sub-chip, only one visible at a time) */
.bubble .rc-panel-area {
  max-height: 540px;
  overflow-y: auto;
  padding: 4px 2px;
}
.bubble .rc-panel {
  display: none;
  position: relative; /* for the hover-revealed copy button */
  border-radius: 6px;
  transition: box-shadow 0.15s;
}
.bubble .rc-panel.active { display: block; }
.bubble .rc-panel:hover {
  box-shadow: 0 0 0 2px rgba(45, 74, 124, 0.15);
}
.bubble .rc-panel-body { font-size: 13px; line-height: 1.6; }
.bubble .rc-panel-body p { margin: 8px 0; }
.bubble .rc-panel-body code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.bubble .rc-panel-body a { color: #2d4a7c; text-decoration: none; border-bottom: 1px dotted #2d4a7c; word-break: break-all; }
.bubble .rc-panel-body a:hover { background: #f5f5f4; border-bottom-style: solid; }
.bubble .rc-panel-body a.path-link { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.bubble .rc-panel-body pre { background: rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.1); border-radius: 6px; padding: 10px 12px; overflow-x: auto; margin: 8px 0; }

/* Hover-revealed copy icon (focus-mode proxy per focus-mode.zoom-not-navigate.001).
   Per operator refinement 2026-06-11 14:49: hovering a section's content area
   reveals a small "copy" icon at the top-right of that area. Click = copy
   the content for paste-into-AI (the standalone-app substitute for the live
   AI "focus" that FreshVibe Studio would provide).
   Per operator refinement 2026-06-11 14:55: the icon style matches the
   minimax document hub — a chain-link glyph inside a rounded square button
   with a subtle border. */
.bubble .rc-panel-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #ffffff;
  border: 1px solid #d6d3d1;
  border-radius: 8px;
  color: #57534e;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s, color 0.12s, border-color 0.12s;
  z-index: 1;
  padding: 0;
}
.bubble .rc-panel:hover .rc-panel-copy { opacity: 1; }
.bubble .rc-panel-copy:hover { background: #f5f5f4; color: #1c1917; border-color: #a8a29e; }
.bubble .rc-panel-copy.copied { background: #dcfce7; color: #166534; border-color: #bbf7d0; opacity: 1; }
.bubble .rc-panel-copy svg { display: block; }

/* Front-of-bubble copy-raw button (next to view report) was removed in v24 per operator. */

/* Card front: no hover border, no padding, plain surface. */
.bubble .card-front {
  border-radius: 8px;
  transition: none;
}
.bubble .copy-btn {
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(0,0,0,0.08);
  font-size: 12px;
  font-family: inherit;
  color: #44403c;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.bubble .copy-btn:hover { background: rgba(255,255,255,0.9); }
.bubble .copy-btn.copied {
  background: #dcfce7; color: #166534; border-color: #bbf7d0;
}

.chat-block .tag-row {
  padding: 10px 16px 14px;
  background: #fafaf9;
  border-top: 1px solid #e7e5e4;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag-chip {
  font-size: 11px;
  background: #ffffff;
  border: 1px solid #d6d3d1;
  color: #57534e;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  cursor: pointer;
  transition: all 0.12s;
}
.tag-chip:hover { background: #f5f5f4; border-color: #a8a29e; }
.tag-chip.active { background: #1c1917; color: #fafaf9; border-color: #1c1917; }

.status-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  font-family: inherit;
}
.status-badge.completed { background: #dcfce7; color: #166534; }
.status-badge.received { background: #e7e5e4; color: #44403c; }
.status-badge.in-progress { background: #fef3c7; color: #92400e; }
.status-badge.superseded { background: #fee2e2; color: #991b1b; }
.status-badge.unknown { background: #e7e5e4; color: #78716c; }

/* ----- Anchor rail (Notion-style, right side, always visible) ----- */
.anchor-rail {
  position: fixed;
  top: 90px; /* start below the header instead of vertically centering */
  right: 12px;
  bottom: 80px; /* don't go past the page footer area */
  width: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* clusters flow from top */
  padding: 8px 0;
  z-index: 90; /* below panel (100) but above search dropdown (40) */
  pointer-events: auto;
  /* Vertical timeline line running through the middle */
  background-image: linear-gradient(to bottom, transparent 0%, #e7e5e4 8%, #e7e5e4 92%, transparent 100%);
  background-size: 1px 100%;
  background-repeat: no-repeat;
  background-position: center;
  gap: 0;
  overflow: hidden; /* never overflow past the viewport */
}
.rail-anchor {
  width: 7px;
  height: 7px;
  background: #ffffff;
  border: 1.5px solid #a8a29e;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  margin: 2px 0;
  z-index: 1;
  padding: 0;
}
.rail-anchor:hover { border-color: #1c1917; transform: scale(1.4); }
.rail-anchor.active {
  background: #1c1917;
  border-color: #1c1917;
  transform: scale(1.4);
  box-shadow: 0 0 0 3px rgba(45, 74, 124, 0.15);
}
.rail-cluster {
  width: 6px;
  background: #a8a29e;
  border-radius: 3px;
  cursor: pointer;
  border: none;
  padding: 0;
  flex-shrink: 0;
  /* Fixed compact height — clusters are slim bars, not tall columns */
  height: 10px !important; /* override inline height: always compact */
  min-height: 10px;
  max-height: 14px; /* active state with box-shadow can grow slightly */
  margin: 1px 0;
  transition: all 0.15s;
  z-index: 1;
}
.rail-cluster:hover { background: #57534e; }
.rail-cluster.active {
  background: #1c1917;
  box-shadow: 0 0 0 3px rgba(45, 74, 124, 0.15);
}

/* ----- Hover panel (anchored to rail, fixed position) ----- */
.anchor-panel {
  position: fixed;
  top: 80px;
  right: 52px;
  width: 280px;
  max-height: 70vh;
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  z-index: 100; /* above search dropdown (z-index: 40) so panel stays on top when both are open */
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}
.anchor-panel.open { display: flex; }
.anchor-panel .panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid #e7e5e4;
  font-size: 12px;
  font-weight: 600;
  color: #1c1917;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.anchor-panel .panel-header .panel-count { color: #78716c; font-weight: 400; }
.anchor-panel .panel-filters {
  padding: 6px 10px;
  border-bottom: 1px solid #e7e5e4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  background: #fafaf9;
}
.anchor-panel .panel-filters .panel-filter-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #78716c;
  font-weight: 600;
  margin-right: 4px;
}
.anchor-panel .panel-filters button {
  background: #ffffff;
  border: 1px solid #d6d3d1;
  color: #57534e;
  font-size: 10px;
  font-family: inherit;
  padding: 2px 7px;
  border-radius: 999px;
  cursor: pointer;
}
.anchor-panel .panel-filters button:hover { background: #f5f5f4; }
.anchor-panel .panel-filters button.active { background: #1c1917; color: #fafaf9; border-color: #1c1917; }
.anchor-panel .panel-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}
.anchor-panel .day-group { display: block; }
.anchor-panel .day-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 14px 6px;
  background: #fafaf9;
  border: none;
  border-top: 1px solid #f5f5f4;
  border-bottom: 1px solid #e7e5e4;
  text-align: left;
  font-family: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: #57534e;
  cursor: pointer;
  transition: background 0.1s;
  position: sticky;
  top: 0;
  z-index: 3;
  /* Solid background mask so prompt content scrolls behind without bleeding through */
  box-shadow: 0 1px 0 #f5f5f4;
}
.anchor-panel .day-header:hover { background: #f5f5f4; }
.anchor-panel .day-header-today {
  color: #1c1917;
  font-size: 12px;
  background: #fafaf9;
}
.anchor-panel .day-header.expanded { border-bottom-color: #e7e5e4; }
.anchor-panel .day-chevron {
  font-size: 10px;
  color: #a8a29e;
  width: 10px;
  flex-shrink: 0;
}
.anchor-panel .day-header-today .day-chevron { color: #1c1917; }
.anchor-panel .day-label { flex: 1; }
.anchor-panel .day-count {
  background: #ffffff;
  border: 1px solid #e7e5e4;
  color: #78716c;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.anchor-panel .day-header-today .day-count {
  background: #1c1917;
  color: #fafaf9;
  border-color: #1c1917;
}
.anchor-panel .day-items { display: block; }
.anchor-panel .panel-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 14px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: #1c1917;
  line-height: 1.4;
  transition: background 0.1s;
  word-wrap: break-word;
}
.anchor-panel .panel-item:hover { background: #f5f5f4; }
.anchor-panel .panel-item.active { background: #e0e7ff; }
.anchor-panel .panel-item .panel-item-time {
  display: inline-block;
  font-size: 11px;
  color: #78716c;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  margin-right: 8px;
  font-weight: 500;
  min-width: 38px;
}
.anchor-panel .panel-empty {
  padding: 20px 14px;
  color: #78716c;
  font-size: 12px;
  text-align: center;
  font-style: italic;
}
.rail-dot {
  /* legacy class — superseded by .rail-anchor (Notion-style dash) */
  display: none;
}

/* Legacy popup classes — superseded by .anchor-panel */

/* ----- Empty state ----- */
.empty-state {
  text-align: center;
  color: #78716c;
  padding: 60px 0;
  font-style: italic;
}

/* ----- Footer ----- */
.site-footer {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid #e7e5e4;
  color: #78716c;
  font-size: 13px;
  text-align: center;
}
.site-footer a { color: #2d4a7c; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ----- Markdown rendering ----- */
.md { font-size: 14px; line-height: 1.7; color: #292524; }
.md h1, .md h2, .md h3, .md h4 { color: #1c1917; margin: 18px 0 10px; font-weight: 600; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; }
.md h3 { font-size: 15px; } .md h4 { font-size: 14px; }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0; padding-left: 22px; }
.md li { margin: 4px 0; }
.md code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: rgba(0,0,0,0.06);
  color: #1c1917;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
}
.md pre {
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 10px 0;
}
.md pre code { background: none; padding: 0; color: #292524; font-size: 12px; line-height: 1.5; }
.md blockquote {
  border-left: 3px solid #d6d3d1;
  padding-left: 12px;
  margin: 10px 0;
  color: #57534e;
  font-style: italic;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
}
.md hr { border: none; border-top: 1px solid #e7e5e4; margin: 16px 0; }
.md a { color: #2d4a7c; text-decoration: none; border-bottom: 1px dotted #2d4a7c; }
.md a:hover { border-bottom-style: solid; }
.md strong { color: #1c1917; }
.md em { color: #44403c; }

/* Prompt ID (per operator 2026-06-11 21:20). Stable numeric position in
   the archive. Monospace, soft grey, click to copy '#N'. */
.prompt-id {
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 11px;
  color: #57534e;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  border-radius: 4px;
  padding: 2px 6px;
  margin-right: 6px;
  cursor: pointer;
  font-weight: 500;
  user-select: none;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.prompt-id:hover {
  background: #e0e7ff;
  border-color: #c7d2fe;
  color: #1e3a8a;
}
.prompt-id:active { transform: scale(0.95); }

/* Favourites (per operator 2026-06-11 19:21; heart icon refined 17:21) */
.fav-heart {
  background: transparent;
  border: none;
  padding: 4px;
  margin-left: 4px;
  cursor: pointer;
  color: #a8a29e;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s, transform 0.1s;
  vertical-align: middle;
}
.fav-heart:hover { color: #e11d48; background: #fff1f2; }
.fav-heart.active { color: #e11d48; }
.fav-heart.active:hover { background: #ffe4e6; }
.fav-heart:active { transform: scale(0.92); }
.fav-heart svg { display: block; }
.fav-heart:focus-visible {
  outline: 2px solid #e11d48;
  outline-offset: 2px;
}
/* Soft warm tint on the whole card when favourited */
.chat-block.fav {
  background: #fffaf0;
  border-left: 3px solid #fda4af;
  border-radius: 0 8px 8px 0;
  padding-left: 4px;
}
/* Favourites filter chip in the project chip row */
.chip-fav {
  background: #fff1f2;
  border-color: #fda4af;
  color: #9f1239;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chip-fav:hover { background: #ffe4e6; border-color: #fb7185; }
.chip-fav.active { background: #fda4af; color: #881337; border-color: #fb7185; }
.chip-fav-heart { font-size: 12px; line-height: 1; color: #e11d48; }
.chip-fav-count {
  font-size: 10px;
  background: rgba(225, 29, 72, 0.12);
  color: #9f1239;
  padding: 0 5px;
  border-radius: 999px;
  font-weight: 500;
}
.chip-fav.active .chip-fav-count {
  background: rgba(136, 19, 55, 0.18);
  color: #881337;
}

/* Floating back-to-top button (per operator 2026-06-11 19:09).
   Bottom-left to avoid clashing with the right-edge anchor rail. */
.back-to-top {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #d6d3d1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #57534e;
  z-index: 60; /* above search dropdown (40), below rail (90) and panel (100) */
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out, background 0.1s, box-shadow 0.1s, color 0.1s;
  padding: 0;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  background: #f5f5f4;
  color: #1c1917;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.back-to-top svg { display: block; }
.back-to-top:focus-visible {
  outline: 2px solid #2d4a7c;
  outline-offset: 2px;
}
@media (max-width: 720px) {
  .back-to-top { left: 10px; bottom: 10px; width: 36px; height: 36px; }
}

/* Mobile backdrop for the panel (dims the rest of the screen when open) */
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}
.panel-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Inline canonical doc viewer (per operator 2026-06-11 23:08). When a
   prompt has canonical_doc_text inlined in the manifest, the doc chip
   becomes a toggle button that expands the full doc as markdown in
   place. No external link, no Cloudflare Access bouncing. */
.rc-doc-inline { padding: 4px 0; }
.rc-doc-toggle {
  display: block;
  width: 100%;
  padding: 8px 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 12px;
  color: #0c4a6e;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.rc-doc-toggle:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}
.rc-doc-viewer {
  margin-top: 8px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 6px;
  max-height: 70vh;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.55;
}
.rc-doc-viewer h1 { font-size: 18px; margin: 0 0 8px; padding-bottom: 4px; border-bottom: 1px solid #e7e5e4; }
.rc-doc-viewer h2 { font-size: 15px; margin: 12px 0 6px; }
.rc-doc-viewer h3 { font-size: 14px; margin: 10px 0 4px; }
.rc-doc-viewer p { margin: 0 0 8px; }
.rc-doc-viewer ul, .rc-doc-viewer ol { margin: 0 0 8px; padding-left: 24px; }
.rc-doc-viewer li { margin-bottom: 2px; }
.rc-doc-viewer hr { border: none; border-top: 1px solid #e7e5e4; margin: 12px 0; }
.rc-doc-viewer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
/* Per operator 2026-06-12 (Task 2): multi-doc inline viewer. Each doc
   gets its own toggle + collapsible viewer. The header line summarises
   how many docs are inlined so the user knows what to expect. */
.rc-doc-inline-multi { padding: 4px 0; }
.rc-doc-inline-multi-header {
  font-size: 12px;
  color: #78716c;
  margin: 0 0 6px 0;
  font-style: italic;
}
.rc-doc-inline-block { margin-bottom: 8px; }
.rc-doc-inline-multi-note {
  font-size: 12px;
  color: #78716c;
  margin: 8px 0 4px 0;
}
.rc-doc-copy-btn {
  background: #ffffff;
  border: 1px solid #d6d3d1;
  border-radius: 6px;
  padding: 4px 10px;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 11px;
  color: #57534e;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.rc-doc-copy-btn:hover {
  background: #f0f9ff;
  color: #0c4a6e;
  border-color: #7dd3fc;
}
   Image gallery, doc list, link summary. */
.rc-image-gallery { padding: 0; }
.rc-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  padding: 4px 0;
}
.rc-gallery-item {
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e7e5e4;
  transition: transform 0.15s, border-color 0.15s;
}
.rc-gallery-item:hover {
  transform: scale(1.05);
  border-color: #2d4a7c;
}
.rc-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rc-gallery-more {
  margin-top: 6px;
  font-size: 11px;
  color: #78716c;
  font-style: italic;
  text-align: center;
}
.rc-doc-list { padding: 4px 0; }
.rc-doc-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rc-doc-link {
  display: inline-flex;
  align-items: center;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 12px;
  color: #2d4a7c;
  text-decoration: none;
  padding: 4px 8px;
  background: #f5f5f4;
  border-radius: 4px;
  border: 1px solid #e7e5e4;
  transition: background 0.1s, border-color 0.1s;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rc-doc-link:hover {
  background: #e0e7ff;
  border-color: #c7d2fe;
}
.rc-link-list { padding: 4px 0; }
.rc-link-summary {
  display: inline-block;
  font-size: 12px;
  color: #2d4a7c;
  padding: 6px 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  transition: background 0.1s, border-color 0.1s;
}
.rc-link-summary:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}
#build-sha {
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 11px;
  color: #78716c;
}
#build-sha a {
  color: #2d4a7c;
  text-decoration: none;
  border-bottom: 1px dashed #c7d2fe;
  padding-bottom: 1px;
  transition: color 0.1s, border-color 0.1s;
}
#build-sha a:hover {
  color: #1e3a8a;
  border-bottom-color: #1e3a8a;
}
@media (max-width: 720px) {
  .page { padding: 20px 16px 60px; }
  .site-header h1 { font-size: 22px; }
  .main { gap: 0; padding-right: 24px; /* leave room for the rail */ }
  .anchor-rail {
    /* Keep the rail visible on mobile, just smaller and tucked into the edge */
    right: 6px;
    width: 10px;
  }
  .rail-anchor { width: 5px; height: 5px; border-width: 1px; }
  .rail-cluster { width: 4px; min-height: 10px; }
  .anchor-panel {
    /* On mobile, the panel slides in from the right edge */
    right: 0;
    left: auto;
    top: 0;
    width: 85vw;
    max-width: 340px;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.25s ease-out;
  }
  .anchor-panel.open { transform: translateX(0); }
  .bubble { max-width: 95%; }
  /* On mobile, the search bar takes the full width with no margin for the rail */
  .search-bar-top { padding-right: 0; }
}

button:focus-visible, input:focus-visible, .chip:focus-visible,
.tag-chip:focus-visible, .rail-dot:focus-visible, .anchor-item:focus-visible {
  outline: 2px solid #2d4a7c; outline-offset: 2px;
}
html { scroll-behavior: smooth; }
