:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  background: #0c1118;
  color: #e8eef6;
}
* { box-sizing: border-box; }
body { margin: 0; background: #0c1118; color: #e8eef6; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: 1.25rem 2rem; border-bottom: 1px solid #273345; background: #111925;
}
h1, h2 { margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1rem; margin-bottom: .9rem; }
main { max-width: 1440px; margin: 0 auto; padding: 1.5rem; }
.panel { background: #121b28; border: 1px solid #28364a; border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.narrow { max-width: 540px; margin: 3rem auto; }
.hidden { display: none !important; }
.subtle { color: #9fb0c3; margin: .35rem 0; font-size: .9rem; }
.badge { display: inline-block; border: 1px solid #3a4b62; border-radius: 999px; padding: .28rem .6rem; color: #b9c8d9; font-size: .8rem; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: grid; gap: .35rem; margin-bottom: .75rem; color: #cbd7e5; font-size: .9rem; }
input, select, textarea {
  width: 100%; border: 1px solid #34455c; border-radius: 7px; background: #0c1420; color: #eef4fb;
  padding: .58rem .65rem;
}
textarea { resize: vertical; }
button { border: 1px solid #5275a5; border-radius: 7px; background: #214f82; color: white; padding: .55rem .8rem; }
button.secondary { background: #172334; border-color: #3b4b61; color: #dce7f4; }
button.small { padding: .35rem .6rem; font-size: .82rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions, .section-heading, .session-row, .inline-form { display: flex; gap: .6rem; align-items: center; }
.section-heading, .session-row { justify-content: space-between; }
.inline-form input { flex: 1; }
.session-row span { margin-left: .75rem; }
.card-list { display: grid; gap: .6rem; }
.card { border: 1px solid #2d3b4f; border-radius: 8px; background: #0e1723; padding: .75rem; }
.card-title { font-weight: 650; word-break: break-word; }
.card-meta { color: #97a9bc; font-size: .82rem; margin: .25rem 0 .55rem; word-break: break-word; }
.card-actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.card-actions select { width: auto; min-width: 150px; }
.json-view { min-height: 220px; max-height: 620px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: #090f17; border: 1px solid #263449; border-radius: 8px; padding: .8rem; }
.compact { margin: .25rem 0 0; padding-left: 1.2rem; color: #b7c5d5; }
.compact li { margin: .3rem 0; }
.status {
  position: fixed; right: 1rem; bottom: 1rem; max-width: min(520px, calc(100vw - 2rem));
  background: #142032; border: 1px solid #3c5270; border-radius: 8px; padding: .7rem .9rem;
  box-shadow: 0 8px 28px rgba(0,0,0,.35); display: none;
}
.status.visible { display: block; }
.status.error { border-color: #874b57; background: #321921; }
@media (max-width: 900px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 1rem; }
  main { padding: 1rem; }
}
h3 { margin: 0; font-size: .95rem; }
.member-panel { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #28364a; }
.compact-list { margin-top: .7rem; }


/* v0.45 browser chronology; read-only client of v0.44 timeline/provenance routes. */
.case-chronology-panel { min-height: 28rem; }
.timeline-list { display: grid; gap: .55rem; }
.timeline-row {
  width: 100%; text-align: left; display: grid; grid-template-columns: minmax(9rem, 12rem) minmax(9rem, 12rem) 1fr;
  gap: .75rem; align-items: start; border: 1px solid #34455c; border-radius: 8px; background: #0c1420; color: #eef4fb;
  padding: .7rem .8rem;
}
.timeline-row:hover, .timeline-row:focus-visible { border-color: #6c87aa; outline: none; }
.timeline-row.selected { border-color: #9db7d6; background: #142238; }
.timeline-date { color: #b9c8d9; font-variant-numeric: tabular-nums; }
.timeline-type { color: #91a9c5; font-size: .82rem; word-break: break-word; }
.timeline-main { min-width: 0; }
.timeline-title { font-weight: 650; overflow-wrap: anywhere; }
.timeline-summary { color: #9fb0c3; font-size: .86rem; margin-top: .2rem; overflow-wrap: anywhere; }
.provenance-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.provenance-panel h3 { margin: 0 0 .55rem; font-size: .95rem; }
.timeline-entry-detail { margin-bottom: .75rem; }
.provenance-detail { display: grid; gap: .55rem; }
.provenance-card { border: 1px solid #2e3d52; border-radius: 7px; padding: .65rem .75rem; background: #0d1622; }
.provenance-card strong { display: block; margin-bottom: .28rem; }
.provenance-kv { display: grid; grid-template-columns: minmax(8rem, 11rem) 1fr; gap: .25rem .65rem; font-size: .84rem; }
.provenance-kv dt { color: #8fa4bb; }
.provenance-kv dd { margin: 0; overflow-wrap: anywhere; }
.provenance-edge { font-size: .84rem; color: #cbd7e5; overflow-wrap: anywhere; }
@media (max-width: 850px) {
  .timeline-row { grid-template-columns: 1fr; gap: .25rem; }
  .provenance-kv { grid-template-columns: 1fr; }
}

/* v0.46 browser review queue; client of existing decide_review routes. */
.review-queue-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.review-queue-panel h3 { margin: 0 0 .55rem; font-size: .95rem; }
.review-queue-list { display: grid; gap: .55rem; }
.review-item { border: 1px solid #2e3d52; border-radius: 8px; background: #0d1622; padding: .75rem; }
.review-item-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.review-item-kind { color: #91a9c5; font-size: .82rem; }
.review-item-summary { font-weight: 650; overflow-wrap: anywhere; margin: .25rem 0 .45rem; }
.review-item-meta { color: #97a9bc; font-size: .82rem; margin-bottom: .55rem; overflow-wrap: anywhere; }
.review-item-form { display: grid; gap: .45rem; }
.review-item-form textarea, .review-item-form input { margin: 0; }
.review-item-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* v0.47 browser conflicts; client of existing scan/list/resolve routes. */
.conflict-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.conflict-panel h3 { margin: 0; font-size: .95rem; }
.conflict-list { display: grid; gap: .55rem; margin-top: .55rem; }
.conflict-item { border: 1px solid #2e3d52; border-radius: 8px; background: #0d1622; padding: .75rem; }
.conflict-item-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.conflict-item-type { font-weight: 650; overflow-wrap: anywhere; }
.conflict-item-meta { color: #97a9bc; font-size: .82rem; margin: .3rem 0 .55rem; overflow-wrap: anywhere; }
.conflict-item-form { display: grid; gap: .45rem; }
.conflict-item-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* v0.48 browser action list; complete/cancel only. */
.action-queue-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.action-queue-panel h3 { margin: 0 0 .55rem; font-size: .95rem; }
.action-list { display: grid; gap: .55rem; margin-top: .55rem; }
.action-item { border: 1px solid #2e3d52; border-radius: 8px; background: #0d1622; padding: .75rem; }
.action-item-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.action-item-title { font-weight: 650; overflow-wrap: anywhere; }
.action-item-meta { color: #97a9bc; font-size: .82rem; margin: .3rem 0 .55rem; overflow-wrap: anywhere; }
.action-item-form { display: grid; gap: .45rem; }
.action-item-actions { display: flex; flex-wrap: wrap; gap: .4rem; }


/* v0.49 browser correspondence; client of existing correspondence routes. */
.correspondence-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.correspondence-panel h3 { margin: 0; font-size: .95rem; }
.correspondence-form { display: grid; gap: .55rem; margin: .65rem 0; }
.correspondence-list { display: grid; gap: .55rem; margin-top: .55rem; }
.correspondence-item { border: 1px solid #2e3d52; border-radius: 8px; background: #0d1622; padding: .75rem; }
.correspondence-item-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.correspondence-item-meta { color: #97a9bc; font-size: .82rem; margin: .3rem 0 .45rem; overflow-wrap: anywhere; }
.correspondence-item-notes { font-size: .88rem; margin-bottom: .45rem; overflow-wrap: anywhere; }
.correspondence-item-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* v0.50 browser packet export; client of existing v0.38 bundle route. */
.packet-export-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.packet-export-panel h3 { margin: 0; }
.packet-export-form { margin-top: .65rem; }


/* v0.51 browser assisted Send; client of existing v0.39 send ledger. No transport. */
.send-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.send-panel h3 { margin: 0; }
.transport-warning { border: 1px solid #8a6a42; background: #20190f; color: #f2d2a6; border-radius: 8px; padding: .65rem .75rem; margin: .65rem 0; font-weight: 600; }
.send-prepare-form { border: 1px solid #2d3b4f; border-radius: 8px; padding: .75rem; margin: .75rem 0; background: #0e1723; }
.send-list { display: grid; gap: .65rem; margin-top: .7rem; }
.send-item { border: 1px solid #365066; border-radius: 8px; background: #0d1721; padding: .75rem .8rem; }
.send-item.draft { border-left: 4px solid #8a6a42; }
.send-item.confirmed { border-left: 4px solid #4e8064; }
.send-item.cancelled { border-left: 4px solid #7c4a52; }
.send-item-heading { display: flex; gap: .6rem; justify-content: space-between; align-items: flex-start; }
.send-item-meta { color: #9eb2c7; font-size: .82rem; margin: .35rem 0 .55rem; overflow-wrap: anywhere; }
.send-controls { display: grid; grid-template-columns: 1fr auto; gap: .45rem; margin-top: .55rem; }
.send-controls input { margin: 0; }
.send-item-actions { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .5rem; }
@media (max-width: 850px) { .send-controls { grid-template-columns: 1fr; } }

.action-create-form { display: grid; gap: .55rem; margin: .6rem 0 .8rem; padding: .7rem; border: 1px solid #2e3d52; border-radius: 8px; background: #0b1420; }
.action-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .4rem; }
.action-inline-controls { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.action-inline-controls input { flex: 1 1 12rem; min-width: 0; }
.action-item-description { color: #b9c8d9; font-size: .88rem; margin: 0 0 .55rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.action-deadline-proposal { margin: .45rem 0 .6rem; border-left: 3px solid #9db7d6; padding: .45rem .6rem; background: #132136; font-weight: 650; overflow-wrap: anywhere; }
@media (max-width: 760px) { .action-edit-grid { grid-template-columns: 1fr; } }


/* v0.53 timeline controls; client of existing v0.44 filter/pagination contract. */
.timeline-filter-form { display: grid; gap: .55rem; margin: .65rem 0 .8rem; padding: .7rem; border: 1px solid #2e3d52; border-radius: 8px; background: #0b1420; }
.timeline-filter-flags { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.timeline-filter-flags label { display: flex; gap: .4rem; align-items: center; margin: 0; }
.timeline-filter-flags input { width: auto; margin: 0; }
.timeline-page-actions { margin-top: .55rem; }


/* v0.54 structured intake review; renders only the workflow-safe intake projection. */
.intake-detail { display: grid; gap: .7rem; }
.intake-detail-head { display: flex; justify-content: space-between; gap: .75rem; align-items: center; }
.intake-detail-meta { display: grid; gap: .25rem; color: #b9c8d9; font-size: .88rem; }
.intake-submission-list { display: grid; gap: .6rem; }
.intake-submission { border: 1px solid #2e3d52; border-radius: 8px; background: #0d1622; padding: .7rem; display: grid; gap: .3rem; }
.intake-submission-head { font-weight: 650; overflow-wrap: anywhere; }
.intake-presence-grid { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.intake-presence { border: 1px solid #34455c; border-radius: 999px; padding: .2rem .5rem; font-size: .78rem; }
.intake-presence.present { color: #cfe6d7; border-color: #4e8064; }
.intake-presence.absent { color: #9fb0c3; }


/* v0.55 research history explorer; read-only projection of tenant-scoped research_results. */
.research-history-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.research-history-panel h3 { margin: 0; }
.research-history-controls { display: flex; gap: .7rem; align-items: end; flex-wrap: wrap; margin: .55rem 0; }
.research-history-controls label { margin: 0; min-width: 12rem; }
.research-history-list { display: grid; gap: .55rem; margin-top: .55rem; }
.research-result { border: 1px solid #2e3d52; border-radius: 8px; background: #0d1622; padding: .75rem; }
.research-result-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.research-result-title { font-weight: 650; overflow-wrap: anywhere; }
.research-result-meta { color: #97a9bc; font-size: .82rem; margin: .3rem 0 .45rem; overflow-wrap: anywhere; }
.research-result-caveat { color: #c3cfdb; font-size: .86rem; margin: .35rem 0 .55rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.research-result-actions { display: flex; flex-wrap: wrap; gap: .4rem; }


/* v0.56 evidence vault browser; case-scoped safe metadata + explicit operator download. */
.evidence-vault-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.evidence-vault-panel h3 { margin: 0; }
.evidence-vault-list { display: grid; gap: .55rem; margin-top: .55rem; }
.evidence-vault-item { border: 1px solid #2e3d52; border-radius: 8px; background: #0d1622; padding: .75rem; }
.evidence-vault-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.evidence-vault-title { font-weight: 650; overflow-wrap: anywhere; }
.evidence-vault-meta { color: #97a9bc; font-size: .82rem; margin: .3rem 0 .55rem; overflow-wrap: anywhere; }
.evidence-vault-actions { display: flex; flex-wrap: wrap; gap: .4rem; }


/* v0.58 durable job engine + bulk evidence ingest. */
.job-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.job-panel h3 { margin: 0; }
.bulk-ingest-form { display: grid; gap: .55rem; margin: .65rem 0; padding: .7rem; border: 1px solid #2e3d52; border-radius: 8px; background: #0b1420; }
.job-list { display: grid; gap: .55rem; margin-top: .55rem; }
.job-item { border: 1px solid #2e3d52; border-radius: 8px; background: #0d1622; padding: .75rem; }
.job-item.running { border-left: 4px solid #638bb6; }
.job-item.succeeded { border-left: 4px solid #4e8064; }
.job-item.partial, .job-item.failed { border-left: 4px solid #9b5960; }
.job-item.cancelled { border-left: 4px solid #6b6f79; }
.job-item-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.job-item-title { font-weight: 650; overflow-wrap: anywhere; }
.job-item-meta { color: #97a9bc; font-size: .82rem; margin: .3rem 0 .55rem; overflow-wrap: anywhere; }
.job-item-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* Investigation Intelligence: derived search/match/graph work surface. */
.investigation-intelligence-panel { margin-top: 1rem; border-top: 1px solid #28364a; padding-top: 1rem; }
.investigation-intelligence-panel h3, .investigation-intelligence-panel h4 { margin: 0; }
.intelligence-search-form { display: grid; gap: .55rem; margin: .65rem 0; }
.intelligence-search-results, .intelligence-match-list, .intelligence-graph, .intelligence-saved-searches { display: grid; gap: .55rem; margin-top: .55rem; }
.intelligence-hit, .intelligence-match, .intelligence-edge, .saved-search-card { border: 1px solid #2e3d52; border-radius: 8px; background: #0d1622; padding: .7rem; }
.intelligence-hit-title, .intelligence-match-title, .intelligence-edge-title { font-weight: 650; overflow-wrap: anywhere; }
.intelligence-hit-meta, .intelligence-match-meta, .intelligence-edge-meta { color: #97a9bc; font-size: .82rem; margin: .3rem 0 .5rem; overflow-wrap: anywhere; }
.intelligence-snippet { white-space: pre-wrap; overflow-wrap: anywhere; color: #c3cfdb; }
.intelligence-subheading { margin-top: .9rem; }
.intelligence-graph-controls { margin-top: .5rem; }
.intelligence-edge.disputed { border-left: 4px solid #9b5960; }
.intelligence-edge.out-of-window { border-right: 4px solid #a88748; }

/* v0.80 Case Home: compact product entry point over existing operational truth. */
.case-home { margin: .7rem 0 1rem; padding: .85rem; border: 1px solid #34455c; border-radius: 9px; background: #0d1622; }
.case-home-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .55rem; margin-top: .7rem; }
.case-home-metric { border: 1px solid #2e3d52; border-radius: 8px; background: #0b1420; padding: .65rem .7rem; }
.case-home-metric strong { display:block; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.case-home-metric span { color:#9fb0c3; font-size:.8rem; }
.case-home-focus-heading { margin-top: .85rem; }
.case-home-focus { display:grid; gap:.5rem; margin-top:.55rem; }
.case-home-focus-item { border:1px solid #2e3d52; border-radius:8px; padding:.65rem .7rem; background:#0c1420; }
.case-home-focus-item .actions { margin-top:.45rem; }
@media (max-width: 850px) { .case-home-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } }

/* v0.81 investigator import UX. Existing bulk/derivation jobs only. */
.case-import-dropzone { margin: 1rem 0; border: 2px dashed #49627f; border-radius: 10px; padding: 1rem; background: #0b1521; transition: border-color .15s ease, background .15s ease; }
.case-import-dropzone h3 { margin: 0 0 .25rem; }
.case-import-dropzone.drag-active { border-color: #9db7d6; background: #132136; }
.case-import-callout { font-weight: 700; text-align: center; padding: .8rem; margin: .65rem 0; border-radius: 8px; background: #101c2b; }
.case-import-dropzone.busy { opacity: .72; pointer-events: none; }


/* v0.82 investigation workspace lanes. Existing APIs remain authoritative. */
.investigation-workspace-shell { margin: 1rem 0; padding: .85rem; border: 1px solid #3b506b; border-radius: 9px; background: #0c1724; }
.investigation-lane-nav { display:flex; flex-wrap:wrap; gap:.5rem; margin:.65rem 0; }
.investigation-lane-button.active { border-color:#9db7d6; background:#1c3047; }
.investigation-lane-member:not(.lane-active) { display:none !important; }
.investigation-lane-member.lane-active { scroll-margin-top: 1rem; }


/* v0.83 investigator operating shell */
.app-mode-nav{display:flex;gap:.5rem;align-items:center;padding:.65rem .8rem;margin-bottom:1rem}
.app-mode-button.active{font-weight:700}
.app-shell{display:block}
#work-shell>.panel,#intake-shell>.panel,#admin-shell>.panel{margin-bottom:1rem}

/* Paste into web/app.css — v0.84 Work two-pane + Review desk */

.app-mode-nav { display:flex; gap:.5rem; flex-wrap:wrap; }
.app-mode-button.active { font-weight:700; }

#work-shell.work-layout,
#work-shell {
  display: grid;
  gap: 1rem;
}
#work-sidebar,
#work-stage { min-width: 0; }
@media (min-width: 960px) {
  #work-shell {
    grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
    align-items: start;
  }
  #work-sidebar { position: sticky; top: .75rem; }
}

.review-desk { display:flex; flex-direction:column; gap:1rem; }
#review-desk-now,
#review-desk-queue { display:flex; flex-direction:column; gap:.75rem; }
#review-desk-context { border:1px solid currentColor; padding:.75rem; }
#review-desk-context > summary { cursor:pointer; font-weight:600; }

/* v0.85 Evidence Import Desk */
.evidence-desk { display:flex; flex-direction:column; gap:1rem; }
#evidence-desk-now,
#evidence-desk-vault { display:flex; flex-direction:column; gap:.75rem; }
#evidence-desk-context { border:1px solid currentColor; padding:.75rem; }
#evidence-desk-context > summary { cursor:pointer; font-weight:600; }

/* v0.86 Intelligence Desk */
.intelligence-desk { display:flex; flex-direction:column; gap:1rem; }
#intelligence-desk-now,
#intelligence-desk-graph { display:flex; flex-direction:column; gap:.75rem; min-width:0; }
#intelligence-desk-context { border:1px solid currentColor; padding:.75rem; }
#intelligence-desk-context > summary { cursor:pointer; font-weight:600; }


/* v0.87 Case Ops Desk */
#case-ops-desk { display:flex; flex-direction:column; gap:1rem; min-width:0; }
#case-ops-desk-now,
#case-ops-desk-timeline,
#case-ops-desk-deliver { display:flex; flex-direction:column; gap:.75rem; min-width:0; }
#case-ops-desk-context { border:1px solid currentColor; padding:.75rem; }
#case-ops-desk-context > summary { cursor:pointer; font-weight:600; }
