/* A quiet reading surface; navigation and evidence remain one action away. */
.investigation-page {
  --conversation-width: 1400px;
  --conversation-gutter: clamp(24px, 4vw, 72px);
}
.investigation-page .canvas {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--canvas);
}
.investigation-page .canvas > header {
  display: flex;
  flex: none;
  height: auto;
  min-height: 68px;
  gap: 12px;
  padding: 12px 24px;
  background: var(--canvas);
  border: 0;
}
.investigation-page .command-trigger { display: none; }
.investigation-page #menu { min-width: 44px; min-height: 44px; }
.chat-heading { flex: 1; min-width: 0; }
.chat-heading h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.investigation-page .context-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
}
.context-toggle .icon { width: 16px; height: 16px; }
.investigation-page .canvas > header .secondary { flex: none; min-height: 36px; padding: 6px 12px; color: var(--muted); font-weight: 500; }
.chat-actions { position: relative; flex: none; }
.chat-actions > summary, #context-close {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  list-style: none;
}
.chat-actions > summary::-webkit-details-marker { display: none; }
.chat-actions-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 30;
  width: 210px;
  padding: 6px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--r-md);
  background: var(--surface-raised);
  box-shadow: var(--el-3);
}
.chat-actions-menu button {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text);
  text-align: left;
  font-size: 13px;
}
.chat-actions-menu button:disabled { color: var(--ink-subtle); cursor: default; }
.chat-actions > summary:hover, #context-close:hover,
.chat-actions-menu button:not(:disabled):hover {
  background: var(--surface-raised);
  color: var(--text);
}
.chat-actions > summary:focus-visible,
.answer-evidence > summary:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}
.investigation-page .chat-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  container-type: normal;
}
.chat-conversation {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.investigation-page #messages {
  display: block;
  position: relative;
  flex: 1;
  min-height: 0;
  max-height: none;
  min-width: 0;
  margin: 0;
  padding: 28px max(var(--conversation-gutter), calc((100% - var(--conversation-width)) / 2)) 24px;
  overflow: auto;
  overscroll-behavior-y: contain;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  mask-image: none;
  -webkit-mask-image: none;
  scrollbar-gutter: stable both-edges;
}
.investigation-page #messages::before,
.investigation-page #messages::after { display: none; }
.investigation-page .message { display: block; margin: 0; animation: none; }
.investigation-page .user-message {
  width: fit-content;
  max-width: 85%;
  margin: 0 0 30px auto;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--surface-raised);
  box-shadow: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: none;
}
.investigation-page .reply {
  min-width: 0;
  margin: 0 0 40px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  animation: none;
}
.reply > b { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.reply-when { margin-left: 10px; font-size: 11px; font-weight: 400; color: var(--ink-subtle); }
.reply p { margin: 0 0 14px; }
/* The answer's own prose is justified; tables, code, headings and the evidence blocks keep their natural alignment.
   No hyphenation: a hostname or identifier must never be split in the middle by the browser. */
.reply > p :is(p, li) {
  text-align: justify;
  text-justify: inter-word;
}
.reply :is(h2, h3, h4) { margin: 24px 0 10px; font-size: 18px; line-height: 1.5; }
.reply :is(ul, ol) { padding-left: 24px; margin: 12px 0 20px; }
.reply li { padding-left: 4px; margin: 10px 0; }
.reply li::marker { color: var(--muted); }
.answer-evidence { margin-top: 18px; color: var(--muted); font-size: 12px; }
.answer-evidence > summary {
  width: fit-content;
  min-height: 28px;
  padding: 3px 0;
  cursor: pointer;
}
.answer-evidence > summary:hover { color: var(--text); }
.answer-evidence p { margin: 10px 0; }
.answer-evidence pre {
  max-height: 320px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  background: var(--surface-deep);
  font: 12px/1.6 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.reply .answer-provenance { color: var(--ink-subtle); font-size: 12px; }
.evidence-facts { display: grid; gap: 1px; margin: 10px 0 14px; border: 1px solid var(--edge); border-radius: var(--r-sm); background: var(--edge); overflow: hidden; }
.evidence-facts > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 8px 12px; background: var(--surface); }
.evidence-facts dt { color: var(--ink-subtle); }
.evidence-facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.answer-evidence .evidence-truncated { margin: 0; padding: 8px 12px; background: color-mix(in srgb, var(--warning) 10%, var(--surface)); color: var(--warning); }
.evidence-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.evidence-count { margin-left: auto; color: var(--ink-subtle); }
.evidence-table-wrap { max-height: 360px; overflow: auto; border: 1px solid var(--edge); border-radius: var(--r-sm); background: var(--surface-deep); }
.evidence-table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 1.5; }
.evidence-table th { position: sticky; top: 0; z-index: 1; padding: 8px 12px; background: var(--surface-raised); border-bottom: 1px solid var(--edge-strong); color: var(--ink-subtle); font-weight: 500; text-align: left; white-space: nowrap; }
.evidence-table td { padding: 8px 12px; border-bottom: 1px solid var(--edge); color: var(--muted); vertical-align: top; overflow-wrap: anywhere; }
.evidence-table tr:last-child td { border-bottom: 0; }
.evidence-table tbody tr:hover td { background: var(--surface-raised); }
.evidence-table .evidence-title { min-width: 220px; color: var(--text); }
.evidence-table :is(.evidence-when, .evidence-status, .evidence-platform) { white-space: nowrap; }
.evidence-table .evidence-status { text-transform: capitalize; }
.evidence-rating { white-space: nowrap; font-weight: 500; }
.evidence-rating::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--ink-subtle); }
.evidence-rating.high { color: var(--danger); }
.evidence-rating.high::before { background: var(--danger); }
.evidence-rating.med { color: var(--warning); }
.evidence-rating.med::before { background: var(--warning); }
.evidence-rating.low { color: var(--ice); }
.evidence-rating.low::before { background: var(--ice); }
@media (max-width: 640px) {
  .evidence-facts > div { grid-template-columns: 1fr; gap: 2px; }
  .evidence-count { margin-left: 0; width: 100%; }
}
.copy-evidence {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12px;
}
.investigation-pending { margin: 12px 0 30px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.investigation-pending b { color: var(--text); font-weight: 500; }
.investigation-pending p { margin: 4px 0; }
.investigation-page .messages-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100%;
  padding: 24px 0;
  text-align: center;
}
.messages-empty-mark { color: var(--ember); }
.messages-empty-mark .icon { width: 28px; height: 28px; }
.messages-empty b { font-size: 28px; font-weight: 600; line-height: 1.3; letter-spacing: -0.5px; }
.messages-empty small { max-width: 440px; font-size: 14px; line-height: 1.7; color: var(--muted); }
.investigation-page #chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-end;
  flex: none;
  gap: 12px;
  width: calc(100% - 2 * var(--conversation-gutter));
  max-width: var(--conversation-width);
  margin: 0 auto;
  padding: 10px 12px 10px 20px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--r-xl);
  background: var(--surface-raised);
  box-shadow: none;
  animation: none;
}
.investigation-page #chat-form::before,
.investigation-page #chat-form::after { display: none; }
.investigation-page #chat-form:has(:is(input, textarea):focus) { outline: 2px solid var(--ember); outline-offset: 2px; }
.investigation-page #chat-input {
  grid-column: 1 / -1;
  display: block;
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 180px;
  padding: 10px 0;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 15px/24px var(--font-sans);
  box-shadow: none;
}
.investigation-page #chat-form .send {
  flex: none;
  width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--ember);
  box-shadow: none;
  color: var(--canvas);
  font-size: 24px;
}
.investigation-page #chat-form .send:disabled { opacity: 0.45; cursor: default; }
.composer-options { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.investigation-page .composer-options .select-control { width: auto; max-width: min(280px, 100%); }
.investigation-page .composer-options .select-trigger {
  min-height: 44px;
  padding: 8px 10px;
  gap: 8px;
  font-size: 13px;
  border-color: transparent;
  border-radius: var(--r-pill);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}
.investigation-page .composer-options .select-trigger:hover { background: var(--surface); color: var(--text); }
.model-notice { width: calc(100% - 2 * var(--conversation-gutter)); max-width: var(--conversation-width); margin: 8px auto 0; font-size: 12px; color: var(--muted); }
.investigation-page .follow-ups {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  width: calc(100% - 2 * var(--conversation-gutter));
  max-width: var(--conversation-width);
  min-height: 36px;
  margin: 10px auto 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.investigation-page .follow-ups button {
  flex: none;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.investigation-page .follow-ups button:hover {
  background: var(--surface-raised);
  border-color: var(--edge-strong);
  box-shadow: none;
  color: var(--text);
  transform: none;
}
.workspace-notice {
  flex: none;
  width: calc(100% - 2 * var(--conversation-gutter));
  max-width: var(--conversation-width);
  max-height: 35vh;
  overflow: auto;
  margin: 0 auto 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 50%, var(--edge));
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.6;
}
.workspace-notice p { margin: 0 0 10px; }
.workspace-notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.workspace-notice-actions .secondary { font-size: 12px; text-decoration: none; }
#investigation-context {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100%);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 20px 24px;
  overflow-y: auto;
  border: 0;
  border-left: 1px solid var(--edge-strong);
  border-radius: 0;
  background: var(--surface-deep);
  box-shadow: var(--el-4);
}
#investigation-context::backdrop { background: color-mix(in srgb, var(--canvas) 65%, transparent); }
.evidence-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.evidence-heading h2 { margin: 0; font-size: 18px; }
.evidence-section { padding: 24px 0; border-bottom: 1px solid var(--edge); }
.evidence-section h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 14px; }
.evidence-section h2 .icon { width: 16px; height: 16px; color: var(--muted); }
.evidence-section dl { margin: 0; font-size: 13px; line-height: 1.6; }
.evidence-section dl > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 8px 0; }
.evidence-section dt { color: var(--ink-subtle); }
.evidence-section dd { margin: 0; overflow-wrap: anywhere; }
#copy-session { width: 44px; min-height: 44px; border: 1px solid var(--edge); border-radius: var(--r-sm); background: none; }
.evidence-section .data-source { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 6px 10px; padding: 10px 0; font-size: 13px; }
.evidence-section .data-source img { width: 24px; height: 24px; grid-row: span 2; }
.evidence-section .data-source small { color: var(--ink-subtle); font-size: 12px; }
.evidence-footnote { color: var(--ink-subtle); font-size: 12px; line-height: 1.6; }
@media (max-width: 700px) {
  .investigation-page .canvas > header { min-height: 60px; padding: 8px 12px; gap: 4px; }
  .chat-heading h1 { font-size: 14px; }
  .investigation-page .canvas > header .account { display: none; }
  .investigation-page .context-toggle { padding: 6px 8px; font-size: 12px; }
  .context-toggle .icon { display: none; }
  .investigation-page #messages { padding: 22px 16px; }
  .investigation-page .user-message { max-width: 95%; padding: 10px 14px; }
  .messages-empty b { font-size: 24px; }
  .investigation-page #chat-form, .investigation-page .follow-ups, .model-notice, .workspace-notice { width: calc(100% - 24px); }
  .investigation-page #chat-form { gap: 8px; padding-left: 14px; }
  #investigation-context { padding: 16px 20px; }
}

/* Message actions: copy on every message, edit on the reader's saved questions. Quiet until
   the message is hovered or focused; always visible on touch screens. */
.investigation-page .user-turn {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: 85%;
  margin: 0 0 30px auto;
}
.investigation-page .user-turn .user-message {
  max-width: 100%;
  margin: 0;
}
.investigation-page .user-edit {
  width: min(640px, 100%);
  padding: 12px 18px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--r-xl);
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.65;
  max-height: 320px;
  resize: none;
}
.investigation-page .user-edit:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}
.msg-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
}
.user-turn:hover .msg-actions,
.reply:hover > .msg-actions,
.msg-actions:focus-within,
.user-turn:has(.user-edit) .msg-actions {
  opacity: 1;
}
@media (hover: none) {
  .msg-actions {
    opacity: 1;
  }
}
.msg-action {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.msg-action:hover,
.msg-action:focus-visible {
  border-color: var(--edge);
  color: var(--text);
}
.msg-action.msg-send {
  border-color: color-mix(in srgb, var(--ember) 50%, transparent);
  color: var(--text);
}
.user-turn:not([data-turn]) .msg-edit {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .msg-actions {
    transition: none;
  }
}

/* The vCISO Agent's proposed schedule: shown, never created until the reader clicks. */
.investigation-page .schedule-proposal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--ember) 35%, transparent);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--ember) 6%, var(--surface-raised));
}
.schedule-proposal dl {
  display: grid;
  gap: 8px;
  margin: 0;
}
.schedule-proposal dl > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
}
.schedule-proposal dt {
  font-size: 13px;
  color: var(--muted);
}
.schedule-proposal dd {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.schedule-proposal-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-subtle);
}
.schedule-proposal .msg-actions {
  opacity: 1;
}
.schedule-proposal .msg-action {
  border-color: var(--edge);
  text-decoration: none;
}
.schedule-proposal .msg-action:disabled {
  opacity: 0.6;
  cursor: default;
}
