/* The parser shares the Workbench's midnight-navy, electric-cyan and ice-mist palette. Dark is
   the default; the toggle explicitly selects the light palette. */
:root {
  color-scheme: dark;
  --on-accent: #031226;
  --band-header: rgba(36, 209, 245, 0.14);
  --band-trailer: rgba(158, 180, 202, 0.12);
  --bg: #061b3a;
  --panel: #082346;
  --panel2: #071e3f;
  --text: #eaf4ff;
  --muted: #b3c2d5;
  --line: #1d5d9f;
  --accent: #24d1f5;
  --warn: #e8bd63;
  --warn-bg: #2f2712;
  --ok: #3df1b7;
  --ok-bg: #06352f;
  --sess-a: rgba(36, 209, 245, 0.05);
  --sess-b: rgba(232, 189, 99, 0.05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eaf4ff;
  --panel: #ffffff;
  --panel2: #f5faff;
  --text: #061b3a;
  --muted: #40556f;
  --line: #bfd1e3;
  --accent: #0e4faf;
  --warn: #8a5a00;
  --warn-bg: #fdf1d8;
  --ok: #14634a;
  --ok-bg: #e2f2ec;
  --sess-a: rgba(11, 110, 168, 0.045);
  --sess-b: rgba(122, 90, 18, 0.045);
  --on-accent: #ffffff;
  --band-header: rgba(11, 110, 168, 0.13);
  --band-trailer: rgba(96, 104, 112, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, var(--panel), var(--panel2));
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

header p {
  color: var(--muted);
  margin-top: 4px;
}

/* The lookup is deliberately part of the local tool chrome rather than a link to an online
   dictionary. Its results float over the page so a field search does not push a live capture
   down the screen. */
.tag-lookup {
  position: relative;
  width: min(340px, 34vw);
  z-index: 4;
}

.tag-lookup label {
  color: var(--muted);
  font: 10px/1.1 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tag-lookup input {
  width: 100%;
  padding: 6px 8px;
  font: 12px/1.25 var(--mono);
  text-transform: none;
  letter-spacing: 0;
}

.tag-lookup-results {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  width: max(340px, 100%);
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  font: 11px/1.35 var(--mono);
}

.tag-lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: center;
  padding: 6px;
  border-bottom: 1px solid var(--line);
}

.tag-lookup-row:last-child { border-bottom: 0; }
.tag-lookup-field { color: var(--text); font-weight: 700; }
.tag-lookup-values { grid-column: 1; color: var(--muted); overflow-wrap: anywhere; }
.tag-lookup-add {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 3px 6px;
  font: 10px/1.2 var(--mono);
}

.privacy {
  align-self: center;
  border: 1px solid var(--ok);
  color: var(--ok);
  border-radius: 999px;
  padding: 8px 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

/* PAGE SCROLL ONLY. No pane owns a scrollbar.
   This was a fixed-viewport app shell -- main pinned to calc(100vh - 86px), panels
   overflow:hidden, inner .table-wrap overflow:auto. That produced nested scrollbars: a long log
   scrolled inside a box while the page stayed still, so you could not see the grid and the
   detail together, and the browser's find-in-page skipped rows that were scrolled out of a
   container it did not know about.
   Everything now grows to its content and the page scrolls. */
main {
  display: grid;
  grid-template-rows: auto 1fr;
}

.input-panel, .grid-panel, .detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
}

.input-panel {
  margin: 16px;
  display: grid;
  grid-template-rows: auto auto auto;
}

/* The whole input area is the target: a dropped log must not navigate the tab
   away from an investigation or land invisibly in one tiny file control. */
.input-panel.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.dictionary-note {
  padding: 0 12px 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  align-items: end;
}

label {
  color: var(--muted);
  display: grid;
  gap: 3px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 7px;
}

select, input, textarea, button {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
}

button {
  cursor: pointer;
  color: var(--on-accent);
  background: var(--accent);
}

button:hover {
  background: var(--accent-hover, var(--accent));
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 14px;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}

textarea.helper-output {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 6px 0 12px;
  background: var(--panel2);
}

textarea.edit-input {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 6px 0 12px;
  background: var(--panel);
}

.template-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 6px 0 12px;
}

.template-controls select {
  max-width: min(100%, 360px);
}

.stats {
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding: 8px 12px;
}

/* Split is a variable so the splitter can move it, and it persists across reloads.
   Default 52%: the detail pane carries five stacked sections -- summary, actions, diagnostics,
   repeating groups, field table -- and the old 30% forced the field table to scroll sideways
   on every message with a long value. */
.results {
  display: grid;
  grid-template-columns: minmax(0, var(--split, 52%)) 10px minmax(360px, 1fr);
  gap: 0;
  padding: 0 16px 16px;
  min-height: 0;
}

.grid-panel { margin-right: 8px; }
.detail-panel { margin-left: 8px; }

/* The splitter is a control, so it looks like one: it shows a grab cursor, highlights on hover
   and focus, and answers arrow keys. A drag handle that only responds to a mouse excludes
   anyone driving by keyboard. */
.splitter {
  cursor: col-resize;
  position: relative;
  border-radius: 2px;
  background: transparent;
  transition: background 120ms ease;
  touch-action: none;
}
.splitter::before {
  content: "";
  position: absolute;
  inset: 12px 4px;
  border-radius: 2px;
  background: var(--line);
}
.splitter:hover::before,
.splitter:focus-visible::before,
.splitter.dragging::before {
  background: var(--accent);
}
.splitter:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (prefers-reduced-motion: reduce) {
  .splitter { transition: none; }
}

.grid-panel, .detail-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  padding: 12px;
  align-content: start;
}

.detail-panel {
  grid-template-rows: repeat(6, auto);
}

#filter {
  margin: 10px 0;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 900px;
}

.detail table {
  min-width: 620px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel2);
  z-index: 1;
}

tbody tr {
  cursor: pointer;
}

/* Was `background: #0c4a6e` unscoped -- a hardcoded leftover from the dark-only stylesheet that
   applied to BOTH tables and rendered a dark blue row on a white page in light mode. */
#messageTable tbody tr.selected {
  background: var(--accent);
}

.selected-summary {
  color: var(--muted);
  padding: 8px 0;
}

.detail-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.detail-view-actions {
  display: flex;
  gap: 5px;
}

.detail-view-actions button {
  padding: 3px 6px;
  background: transparent;
  color: var(--muted);
  font: 10px/1.2 var(--mono);
}

.detail-view-actions button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.selected-raw {
  max-height: 160px;
  margin: 0 0 10px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel2);
  color: var(--text);
  font: 11px/1.4 var(--mono);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

#diagnostics {
  margin: 8px 0 14px;
  padding-left: 20px;
  color: var(--warn);
}

.groups {
  border: 1px solid var(--line);
  background: var(--panel2);
  padding: 8px;
  margin: 8px 0 14px;
  color: var(--muted);
}

.group {
  border-left: 2px solid var(--accent);
  padding-left: 8px;
  margin: 6px 0;
}

.group summary {
  cursor: pointer;
  color: var(--text);
}

.group-entry {
  margin: 6px 0 8px 12px;
}

.group-entry-title {
  color: var(--accent);
  font-size: 12px;
  margin-bottom: 4px;
}

.group-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.group-fields span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--panel2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .results {
    grid-template-columns: 1fr;
  }

  /* Stacked: the splitter has nothing to split. */
  .splitter { display: none; }
  .grid-panel, .detail-panel { margin: 0; }

}

@media (max-width: 760px) {
  header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .header-tools { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  .tag-lookup { width: min(100%, 420px); }
  .tag-lookup-results { right: auto; left: 0; width: min(100vw - 32px, 420px); }
}


/* ---- FIX data is data: monospace, tabular, dense ------------------------------------- */

#messageTable, #timelineTable, #orderTable, #diffTable, #fieldTable, textarea, .groups, #stats {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

#messageTable th, #messageTable td,
#timelineTable th, #timelineTable td,
#orderTable th, #orderTable td,
#diffTable th, #diffTable td,
#fieldTable th, #fieldTable td,
#sequenceTable th, #sequenceTable td {
  padding: 3px 8px;
  white-space: nowrap;
}

/* Sticky headers: a FIX log is long, and a column you cannot name is a column you cannot read. */
#messageTable thead th, #timelineTable thead th, #orderTable thead th, #diffTable thead th, #fieldTable thead th, #sequenceTable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}

.table-wrap { overflow-x: auto; overflow-y: visible; }

/* ---- State encoded in form, not only in text ----------------------------------------- */

/* Session tint. The sample carries two concurrent sessions; without this the grid is one
   undifferentiated stream and a reader has to parse 49->56 on every row to tell them apart. */
#messageTable tbody tr.sess-a { background: var(--sess-a); }
#messageTable tbody tr.sess-b { background: var(--sess-b); }

/* Severity as a stripe, so what needs attention reads at a glance rather than after reading. */
#messageTable tbody tr.has-warn { box-shadow: inset 3px 0 0 var(--warn); }
#messageTable tbody tr.has-warn td:last-child {
  color: var(--warn);
  font-weight: 600;
}
#messageTable tbody tr:not(.has-warn) td:last-child { color: var(--ok); }

#messageTable tbody tr.selected {
  background: var(--accent);
  color: var(--on-accent);
}
#messageTable tbody tr.selected td:last-child { color: var(--on-accent); }
#messageTable tbody tr:hover:not(.selected) { background: var(--panel2); }
#messageTable tbody tr.diff-a td:first-child { border-left: 3px solid var(--accent); }
#messageTable tbody tr.diff-b td:first-child { border-right: 3px solid var(--warn); }

/* ---- Focus is visible, motion is optional -------------------------------------------- */

:where(button, select, input, textarea, tr):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Wide content scrolls inside its own container; the page body never scrolls sideways. */
body { overflow-x: hidden; }

/* ---- Repeating groups, nested in the field list ------------------------------------- */

/* A group count is a parent, not an ordinary field: it earns a rule and weight so the eye
   stops there before descending into the entries. */
#fieldTable tbody tr.grp-count td {
  font-weight: 600;
  border-top: 1px solid var(--line);
}

/* Entry headers name the entry and its position, because "which of the two is this" is the
   question a flat list could never answer -- and it is the only reason the old separate pane
   existed. */
#fieldTable tbody tr.grp-entry-row td {
  color: var(--accent);
  background: var(--panel2);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-top: 5px;
  padding-bottom: 5px;
}

.hint {
  font-weight: 400;
  font-size: 11px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

/* ---- Colour coding -------------------------------------------------------------------
   Deliberately NOT the palette OnixS uses (white-on-#6173A7 header, #0033CC on seq/sender).
   Theirs picks out session identity in one indigo; ours encodes three different things, and
   the most useful is the inverse of what they do -- we DIM the session layer rather than
   highlighting it, because those tags are on every message and none of them is why you opened
   the log. */

/* Structural banding: header, body, trailer. A FIX message has three regions and the boundary
   a reader looks for is where the header stops and the payload starts. Backgrounds are kept
   very low-contrast on purpose -- this is a band, not a highlight, and it must not compete with
   the group nesting or the buy/sell colouring that sit on top of it. */
#fieldTable tbody tr.f-header td { background: var(--band-header); }
#fieldTable tbody tr.f-trailer td { background: var(--band-trailer); }

/* Plumbing recedes so the application payload reads first. */
#fieldTable tbody tr.f-header td:nth-child(1),
#fieldTable tbody tr.f-header td:nth-child(2),
#fieldTable tbody tr.f-trailer td:nth-child(1),
#fieldTable tbody tr.f-trailer td:nth-child(2) {
  color: var(--muted);
}

/* The trailer closes the message, so it gets a rule above it -- the visual full stop. */
#fieldTable tbody tr.f-trailer td { border-top: 1px solid var(--line); }

/* The band belongs to the field, so it survives hover. Without this the region a reader is
   pointing at is the one that loses its banding, which is exactly backwards. */
#fieldTable tbody tr.f-header:hover td { background: var(--band-header); }
#fieldTable tbody tr.f-trailer:hover td { background: var(--band-trailer); }

/* The bytes remain in the selected raw frame; this is only a scanning view, never a lossy
   transform. Repeating-group entries stay visible so the control cannot accidentally conceal
   application data nested under a header count field. */
#fieldTable tbody.hide-plumbing tr.f-header,
#fieldTable tbody.hide-plumbing tr.f-trailer { display: none; }

/* The decoded meaning is the value the dictionary adds, so it is the thing that gets accent. */
#fieldTable tbody td:nth-child(4) {
  color: var(--accent);
}

/* Side and MDEntryType: categorical opposites, NOT severities -- so they must not reuse the
   ok/warn pair, which already means "diagnostics" here. Teal/violet reads as two categories
   rather than good/bad, and stays legible on both grounds. */
#fieldTable tbody tr.v-buy td:nth-child(3),
#fieldTable tbody tr.v-buy td:nth-child(4) { color: #52d6b4; font-weight: 600; }
#fieldTable tbody tr.v-sell td:nth-child(3),
#fieldTable tbody tr.v-sell td:nth-child(4) { color: #c48fe0; font-weight: 600; }

:root[data-theme="light"] #fieldTable tbody tr.v-buy td:nth-child(3),
:root[data-theme="light"] #fieldTable tbody tr.v-buy td:nth-child(4) { color: #0f8a72; }
:root[data-theme="light"] #fieldTable tbody tr.v-sell td:nth-child(3),
:root[data-theme="light"] #fieldTable tbody tr.v-sell td:nth-child(4) { color: #8a4fa8; }

/* ---- Grid tools ---------------------------------------------------------------------- */
.grid-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.grid-tools #filter { flex: 1 1 260px; margin: 0; }
.page-status { color: var(--muted); font-size: 0.9em; font-variant-numeric: tabular-nums; }
.session-filter { min-width: 220px; }
.add-tag { width: 130px; }
.preset-select { min-width: 150px; }
.preset-name { width: 150px; }
.profile-note {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.preset-note {
  font-size: 11px;
  color: var(--muted);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 0;
  margin: -2px 0 8px;
}

.filter-chips:empty { display: none; }
.filter-chips-label {
  color: var(--muted);
  font: 10px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.filter-chip,
.filter-chip-clear {
  padding: 3px 7px;
  border-radius: 999px;
  font: 10px/1.25 var(--mono);
}

.filter-chip-include { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.filter-chip-exclude { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.filter-chip-clear { background: transparent; color: var(--muted); }

.column-manager {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel2);
  overflow: hidden;
}

.column-manager[hidden] { display: none; }
.column-manager-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
.column-manager-head strong { display: block; font-size: 12px; }
.column-manager-head span { color: var(--muted); font-size: 11px; }
.column-manager-head button { padding: 4px 8px; font-size: 11px; }
.column-manager-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1px;
}
.column-manager-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  font: 11px/1.2 var(--mono);
}
.column-manager-row button {
  min-width: 24px;
  padding: 2px 5px;
  font: 12px/1 var(--mono);
}
.column-manager-row button:disabled { cursor: default; opacity: 0.42; }

/* Field filters are an investigation action, not a new parser mode. The controls appear only
   while a value is being inspected; normal scan density is unchanged. */
.filter-cell { position: relative; }
.filter-cell-value { padding-right: 2px; }
.filter-cell-actions { display: inline-flex; gap: 2px; margin-left: 5px; opacity: 0; }
.filter-cell:hover .filter-cell-actions,
.filter-cell:focus-within .filter-cell-actions { opacity: 1; }
.filter-action {
  min-width: 17px;
  padding: 0 3px;
  border-radius: 3px;
  background: var(--panel);
  color: var(--muted);
  font: 11px/1.25 var(--mono);
}
.filter-action:hover,
.filter-action:focus-visible { color: var(--on-accent); background: var(--accent); }

.sequence {
  margin-top: 8px;
}

#timelineTable {
  min-width: 920px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.timeline {
  margin-top: 8px;
  margin-bottom: 12px;
}

#timelineTable tbody tr.timeline-row {
  cursor: pointer;
}

#timelineTable tbody tr.timeline-row.has-warn td:last-child {
  color: var(--warn);
  font-weight: 600;
}

#timelineTable tbody tr.timeline-row td:nth-child(2) {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}
#timelineTable tbody tr.timeline-row td:nth-child(4) { font-weight: 600; }
#timelineTable tbody tr.timeline-type-8 td:nth-child(4) { color: var(--ok); }
#timelineTable tbody tr.timeline-type-D td:nth-child(4),
#timelineTable tbody tr.timeline-type-F td:nth-child(4),
#timelineTable tbody tr.timeline-type-G td:nth-child(4) { color: var(--accent); }
#timelineTable tbody tr.timeline-row td:nth-child(6) { color: var(--muted); }

#timelineTable tbody tr.timeline-row:not(.has-warn) td:last-child {
  color: var(--ok);
}

#timelineTable tbody tr.timeline-row.selected {
  background: var(--accent);
  color: var(--on-accent);
}

#timelineTable tbody tr.timeline-row.selected td:last-child {
  color: var(--on-accent);
}

#timelineTable tbody tr.timeline-row:hover:not(.selected) {
  background: var(--panel2);
}

#timelineTable tbody tr.timeline-empty td {
  color: var(--muted);
  font-style: italic;
}

/* Session protocol stays visually distinct from the generic sequence table. It is
   an offline reconstruction aid: links mean both frames were visible in the current
   filtered rows, not that the browser has proved live-session recovery or current
   peer health. */
.session-protocol {
  margin-top: 8px;
  margin-bottom: 12px;
}

#sessionProtocolTable {
  min-width: 900px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

#sessionProtocolTable tbody tr.session-protocol-row {
  cursor: pointer;
}

#sessionProtocolTable tbody tr.session-protocol-row:hover {
  background: var(--panel2);
}

#sessionProtocolTable tbody tr.protocol-resend-request td:first-child,
#sessionProtocolTable tbody tr.protocol-gap-fill td:first-child {
  color: var(--accent);
  font-weight: 600;
}

#sessionProtocolTable tbody tr.protocol-session-reject td:first-child,
#sessionProtocolTable tbody tr.protocol-business-reject td:first-child {
  color: var(--warn);
  font-weight: 600;
}

#sessionProtocolTable tbody tr.session-protocol-empty td {
  color: var(--muted);
  font-style: italic;
}

.order-lifecycle {
  margin-top: 8px;
  margin-bottom: 12px;
}

#orderTable {
  min-width: 980px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

#orderTable tbody tr.order-row {
  cursor: pointer;
}

#orderTable tbody tr.order-row.selected {
  background: var(--accent);
  color: var(--on-accent);
}

#orderTable tbody tr.order-row:hover:not(.selected) {
  background: var(--panel2);
}

/* A local-review observation is deliberately less severe than a frame diagnostic.
   It describes the currently visible log reconstruction, not a malformed wire frame. */
#orderTable tbody tr.order-row.order-review:not(.selected) td:last-child {
  color: var(--warn);
  font-weight: 600;
}

#orderTable tbody tr.order-empty td {
  color: var(--muted);
  font-style: italic;
}

.diff {
  margin-top: 8px;
  margin-bottom: 12px;
}

#diffTable {
  min-width: 780px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

#diffTable tbody tr.diff-equal td {
  color: var(--muted);
}

#diffTable tbody tr.diff-different td:last-child,
#diffTable tbody tr.diff-missing-in-A td:last-child,
#diffTable tbody tr.diff-missing-in-B td:last-child {
  color: var(--warn);
  font-weight: 600;
}

#diffTable tbody tr.diff-empty td {
  color: var(--muted);
  font-style: italic;
}

#sequenceTable {
  min-width: 720px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

#sequenceTable tbody tr.sequence-event {
  cursor: pointer;
}

#sequenceTable tbody tr.sequence-gap td:first-child {
  color: var(--warn);
  font-weight: 600;
}

#sequenceTable tbody tr.sequence-duplicate td:first-child,
#sequenceTable tbody tr.sequence-low td:first-child {
  color: var(--accent);
  font-weight: 600;
}

#sequenceTable tbody tr.sequence-empty td {
  color: var(--muted);
  font-style: italic;
}

.sort-button {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.sort-button:hover,
.sort-button:focus-visible {
  color: var(--accent);
  background: transparent;
}

/* ---- Diagnostic severity -------------------------------------------------------------
   Three levels by what the reader should DO, not by how bad they sound. A checksum mismatch
   means the bytes may never have been a message; a missing required field means the frame is
   intact and the content is wrong. Rendering both as identical grey lines makes a reader treat
   the list as noise. */
#diagnostics { list-style: none; padding: 0; margin: 8px 0 14px; }

.diag {
  padding: 4px 8px 4px 10px;
  margin: 3px 0;
  border-left: 3px solid var(--line);
  border-radius: 0 3px 3px 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
}

/* The frame is suspect: you may be reading bytes that were never a message. */
.diag-frame { border-left-color: var(--n); background: var(--nbg); color: var(--n); }


/* The frame is fine; the content violates the dictionary. */
.diag-content { border-left-color: var(--warn); background: var(--warn-bg); color: var(--warn); }


/* Structural notes -- usually benign in a log excerpt. */
.diag-shape { border-left-color: var(--muted); background: var(--nabg); }


/* ---- Theme toggle -------------------------------------------------------------------- */
.header-tools { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 68px;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); background: transparent; }

.version-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
