/* Context: the window divided, what the model sees, and compaction
   (js/context.js). Colours are the palette's chart tokens, so the bar reads
   the same in both themes. */

.ctx-dialog .dialog-body { gap: 18px; }
.ctx-panel { display: flex; flex-direction: column; gap: 16px; }

.ctx-hero { display: flex; align-items: center; gap: 16px; }
.ctx-big {
  font-family: var(--display);
  font-size: 44px;
  line-height: 1;
  font-weight: 560;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  animation: settle-in var(--dur-slow) var(--ease-out);
}
.ctx-hero-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ctx-hero-line { color: var(--text); font-size: 14px; }
.ctx-hero-sub { color: var(--text3); font-size: 12.5px; }

.ctx-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}
.ctx-seg {
  flex: none;
  height: 100%;
  transform-origin: left center;
  animation: ctx-grow var(--dur-slow) var(--ease-out) both;
  transition: filter var(--dur) var(--ease-out);
}
.ctx-seg + .ctx-seg { box-shadow: -1px 0 0 var(--raised); }
.ctx-seg:hover { filter: brightness(1.15); }
.ctx-seg.reply {
  margin-left: auto;
  background: repeating-linear-gradient(135deg, var(--border-strong) 0 3px, transparent 3px 7px);
}
@keyframes ctx-grow { from { transform: scaleX(0); } to { transform: none; } }

.ctx-legend { display: flex; flex-direction: column; }
.ctx-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 3.2em;
  align-items: baseline;
  gap: 10px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ctx-row:last-child { border-bottom: 0; }
.ctx-dot { width: 10px; height: 10px; border-radius: 3px; align-self: center; background: var(--surface); }
.ctx-row.reply .ctx-dot { background: repeating-linear-gradient(135deg, var(--border-strong) 0 2px, transparent 2px 4px); }
.ctx-row.free .ctx-dot { box-shadow: inset 0 0 0 1px var(--border-strong); background: none; }
.ctx-label { display: flex; flex-wrap: wrap; gap: 2px 8px; color: var(--text); min-width: 0; }
.ctx-detail { color: var(--text3); font-size: 12px; }
.ctx-tokens, .ctx-share { color: var(--text2); font-variant-numeric: tabular-nums; text-align: right; }
.ctx-share { color: var(--text3); font-size: 12px; }

.ctx-facts { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text2); }
.ctx-fact { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.ctx-fact .icon { width: 14px; height: 14px; color: var(--text3); }
.ctx-fact .ctx-fact-wide { flex: 1 1 0; min-width: 0; }
.ctx-panel .link {
  padding: 0; border: 0; background: none; font: inherit; color: var(--text2); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px;
}
.ctx-panel .link:hover { color: var(--text); }

.ctx-compact {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--card);
}
.ctx-compact[hidden] { display: none; }
.ctx-preview-text { margin: 0; color: var(--text2); font-size: 13px; line-height: 1.55; }
.ctx-preview-text.quiet { color: var(--text3); }
.ctx-go { display: flex; justify-content: flex-end; }

/* What the model sees */
.ctx-view-dialog .dialog-body { gap: 12px; }
.ctx-view-head { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ctx-view { display: flex; flex-direction: column; gap: 4px; }
.ctx-block {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  transition: background var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out);
}
.ctx-block.unsent { opacity: 0.55; }
.ctx-block.unsent:hover { opacity: 0.85; }
.ctx-block-head {
  display: grid;
  grid-template-columns: 16px auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 76px 8px 12px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.ctx-block:not(.message) .ctx-block-head { padding-right: 12px; }
.ctx-block-head:hover { background: var(--card-hover); border-radius: 10px; }
.ctx-block-head .icon { width: 15px; height: 15px; color: var(--text3); }
.ctx-block.summary .ctx-block-head .icon { color: var(--chart-4); }
.ctx-who { font-weight: 560; white-space: nowrap; }
.ctx-first { color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-state {
  padding: 1px 7px; border-radius: 999px; font-size: 11px;
  background: var(--accent-wash); color: var(--accent-ink); white-space: nowrap;
}
.ctx-state.quiet { background: var(--surface); color: var(--text3); }
.ctx-block .ctx-tokens { font-size: 12px; color: var(--text3); min-width: 3em; }
.ctx-marks { position: absolute; top: 4px; right: 6px; display: flex; gap: 2px; }
.ctx-marks .ibtn.on { color: var(--accent-ink); background: var(--accent-wash); }
.ctx-text {
  margin: 0 12px 10px;
  padding: 10px 12px;
  max-height: 260px;
  overflow: auto;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  animation: settle-in var(--dur) var(--ease-out);
}
