/* Inspection view (#9): flat, sharp copies of paperwork over the dimmed scene. */
#inspect { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; }
#inspect[hidden] { display: none; }
#inspect .backdrop {
  position: absolute; inset: 0; background: rgba(8, 10, 9, 0.62); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity 160ms ease-out;
}
#inspect.shown .backdrop { opacity: 1; }

#inspect .panes {
  position: relative; flex: 1; min-height: 0; display: flex; gap: 20px; justify-content: center;
  align-items: flex-start; padding: 20px 16px 8px; overflow: auto;
}
#inspect .toolbar {
  position: relative; display: flex; gap: 8px; justify-content: center; padding: 10px 16px 14px;
  font: 13px/1.4 ui-monospace, monospace;
}
#inspect .toolbar button {
  font: inherit; color: #cfd8cf; background: rgba(0, 0, 0, 0.6); border: 1px solid #3a463e;
  padding: 6px 12px; border-radius: 4px; cursor: pointer;
}
#inspect .toolbar button.active { border-color: #9fd79f; color: #9fd79f; }
#inspect kbd { font: inherit; opacity: 0.6; margin-left: 4px; }
@media (pointer: coarse) { #inspect kbd { display: none; } }

#inspect .pane {
  --printed: #4a5a50; --ink: #1d1b17;
  position: relative; box-sizing: border-box; width: min(620px, 100%); flex: 0 1 auto;
  background: #efe9d8; color: var(--ink); padding: 28px 32px 32px; border-radius: 2px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55); transform-origin: center;
  font: 16px/1.35 "Old Standard TT", Georgia, "Times New Roman", serif;
}
/* Each form type keeps its paper tint from the desk (#21) */
#inspect .pane.document:has(.letterhead[data-form="TR-2"]) { background: #e2e4d2; }
#inspect .panes.two-up .pane { width: min(560px, calc(50% - 10px)); }
#inspect .pane.registry, #inspect .pane.ledger { background: #e6e9dd; }
#inspect .pane.ledger { width: min(900px, 100%); }
#inspect .panes.two-up .pane.ledger { width: min(760px, calc(58% - 10px)); }
#inspect .panes.two-up .pane.document:has(+ .pane.ledger) { width: min(560px, calc(42% - 10px)); }

#inspect .close {
  position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 26px;
  line-height: 1; color: var(--printed); cursor: pointer; padding: 4px 8px;
}
/* Letterhead (#21): colour band, seal beside the Ministry's name and directorate, then the title */
#inspect .letterhead {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center;
  color: var(--printed); margin-bottom: 18px; padding-top: 10px; border-top: 6px solid var(--band, #7a1a14);
}
#inspect .letterhead .seal { grid-row: span 2; color: var(--band, #7a1a14); --seal-ground: transparent; }
#inspect .letterhead > :not(.seal) { grid-column: 1 / -1; }
#inspect .letterhead > .ministry, #inspect .letterhead > .sub { grid-column: 2; }
#inspect .ministry { font: 17px/1.1 "Russo One", "Arial Black", sans-serif; letter-spacing: 0.02em; align-self: end; }
#inspect .sub { font-size: 14px; font-style: italic; align-self: start; }
#inspect h2 {
  margin: 12px 0 6px; padding-top: 10px; border-top: 2px solid var(--printed); text-align: center;
  font: 20px/1.2 "Russo One", "Arial Black", sans-serif; text-transform: uppercase; letter-spacing: 0.01em;
}
#inspect .meta { display: flex; justify-content: space-between; font-size: 14px; }

#inspect tt, #inspect .value, #inspect .ledger td {
  font-family: "Courier Prime", ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  font-variant-numeric: slashed-zero;
}
#inspect .meta tt { font-size: 15px; color: var(--ink); }

#inspect .field { border: 1.5px solid var(--printed); padding: 6px 10px 8px; margin-bottom: 10px; }
#inspect .label { color: var(--printed); font-size: 14px; margin-bottom: 3px; }
#inspect .label i { margin-left: 4px; }
#inspect .value {
  font-size: 19px; font-weight: bold; overflow-wrap: anywhere; min-height: 1.35em; user-select: text;
}
#inspect .value + .value { margin-top: 4px; }

#inspect .index { list-style: none; margin: 0; padding: 0; }
#inspect .index button, #inspect .back {
  width: 100%; display: flex; justify-content: space-between; gap: 12px; text-align: left;
  font: inherit; background: none; border: 0; border-bottom: 1px dotted var(--printed);
  padding: 9px 4px; cursor: pointer; color: var(--ink);
}
#inspect .index button:hover { background: rgba(74, 90, 80, 0.1); }
#inspect .index tt { font-size: 15px; }
#inspect .back { width: auto; border: 0; color: var(--printed); padding: 0; }
#inspect .pages { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; color: var(--printed); font-size: 12px; }
#inspect .flip {
  font: 20px/1 inherit; color: var(--printed); background: none; border: 1.5px solid var(--printed);
  border-radius: 3px; width: 32px; height: 28px; margin-left: 6px; cursor: pointer;
}

#inspect table.ledger { width: 100%; border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; }
#inspect .ledger th { text-align: left; color: var(--printed); font-weight: normal; border-bottom: 1.5px solid var(--printed); padding: 4px 6px; }
#inspect .ledger td { padding: 6px; border-bottom: 1px dotted var(--printed); overflow-wrap: anywhere; vertical-align: top; }
#inspect .ledger td[data-field="code"] { min-width: 9em; }
#inspect .ledger td[data-field="client_id"], #inspect .ledger td[data-field="expires_at"], #inspect .ledger td[data-field="issued_at"],
#inspect .ledger td[data-field="status"] { white-space: nowrap; }
#inspect .ledger tr.used td, #inspect .ledger tr.expired td { color: #7a7a70; }
#inspect .ledger tr.revoked td { color: #8a2a22; }
#inspect .none { color: var(--printed); font-style: italic; }

/* Narrow screens: stack the panes and scroll */
@media (max-width: 760px) {
  #inspect .panes { flex-direction: column; align-items: center; justify-content: flex-start; }
  #inspect .panes.two-up .pane, #inspect .panes.two-up .pane.ledger, #inspect .panes.two-up .pane.sessions,
  #inspect .panes.two-up .pane.document:has(+ .pane.ledger),
  #inspect .panes.two-up .pane.document:has(+ .pane.sessions) { width: 100%; }
  #inspect .pane { padding: 22px 18px 22px; flex: none; }
}

/* Discrepancy linking (#10) */
#inspect .field, #inspect .linkable, #inspect .ledger td { cursor: pointer; }
#inspect .field:hover, #inspect .linkable:hover, #inspect .ledger td:hover { background: rgba(74, 90, 80, 0.08); }
#inspect .pane .linking { outline: 3px dashed #b07a1e; outline-offset: 2px; }
#inspect .pane .discrepancy { outline: 3px solid #a8281e; outline-offset: 2px; }
#inspect .linkable { padding: 2px 4px; margin: -2px -4px; border-radius: 2px; }
#inspect .strings { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
#inspect .strings path { fill: none; stroke-width: 3; stroke-linecap: round; }
#inspect .strings .discrepancy { stroke: #c0392b; fill: none; }
#inspect .strings circle.discrepancy { fill: #c0392b; }
#inspect .strings .match { stroke: #6fae7c; stroke-dasharray: 6 5; }
#inspect .strings circle.match { fill: #6fae7c; }
#inspect .strings .unrelated { stroke: #8a8f88; stroke-dasharray: 6 5; }
#inspect .strings circle.unrelated { fill: #8a8f88; }

#inspect .linkbar {
  position: relative; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap;
  min-height: 30px; padding: 4px 16px 0; font: 13px/1.4 ui-monospace, monospace; color: #cfd8cf;
}
#inspect .linkbar button {
  font: inherit; color: #f0d9a0; background: rgba(0, 0, 0, 0.6); border: 1px solid #6a5a30;
  padding: 3px 10px; border-radius: 4px; cursor: pointer;
}
#inspect .linkbar .hint { opacity: 0.65; }
#inspect .linkbar .discrepancy { color: #ff9c8f; }
#inspect .linkbar .match { color: #9fd79f; }
#inspect .linkbar .unrelated { color: #c8c8b8; }
#inspect .linkbar small, #inspect .finding small { opacity: 0.7; margin-left: 4px; }

#inspect .verdict {
  margin-top: 16px; padding-top: 12px; border-top: 2px solid var(--printed);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
}
#inspect .verdict .findings { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1; }
#inspect .verdict .label { color: var(--printed); font-size: 12px; }
#inspect .verdict .none { color: var(--printed); font-size: 13px; font-style: italic; }
#inspect .finding {
  font: 13px/1.3 inherit; border: 1.5px solid #a8281e; color: #a8281e; background: none;
  padding: 3px 8px; border-radius: 3px; cursor: pointer;
}
#inspect .finding.cited { background: #a8281e; color: #fff; }
#inspect .stamps { display: flex; gap: 8px; }
#inspect .stamps button {
  font: 15px/1 "Russo One", "Arial Black", sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 9px 14px; border: 2.5px solid; border-radius: 3px; background: none; cursor: pointer;
}
#inspect .stamps [data-verdict="approve"] { color: #2f6b3a; }
#inspect .stamps [data-verdict="deny"] { color: #a8281e; }
#inspect .stamps button:disabled { opacity: 0.4; cursor: default; }

/* Hash machine printout (#22): a till-receipt slip stapled under the verifier */
#inspect .printout { margin: -4px 0 10px 24px; }
#inspect .printout .field { background: #f8f6ee; border-style: dashed; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
#inspect .ledger td[data-field="code_challenge"] { min-width: 9em; }
#inspect .ledger td small { display: block; color: var(--printed); }

/* Terminal pane (#13): the raw request in green phosphor */
#inspect .pane.terminal {
  background: #04170c; color: #7dffa6; padding: 0; width: min(760px, 100%);
  font: 15px/1.45 "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", monospace;
  text-shadow: 0 0 4px rgba(125, 255, 166, 0.5); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), inset 0 0 40px rgba(0, 0, 0, 0.6);
}
#inspect .panes.two-up .pane.terminal { width: min(760px, calc(58% - 10px)); }
#inspect .panes.two-up .pane.document:has(+ .pane.terminal) { width: min(560px, calc(42% - 10px)); }
#inspect .pane.terminal .close { color: #04170c; top: 2px; }
#inspect .pane.terminal .status { background: #3fae6a; color: #04170c; text-shadow: none; font-weight: bold; padding: 4px 12px; font-size: 13px; }
#inspect .pane.terminal .http { padding: 14px 16px 14px calc(16px + 2ch); white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
#inspect .pane.terminal .http div { text-indent: -2ch; }
#inspect .pane.terminal .http .name { color: #3fae6a; }
#inspect .pane.terminal .http .request { font-weight: bold; }
@media (max-width: 760px) {
  #inspect .panes.two-up .pane.terminal, #inspect .panes.two-up .pane.document:has(+ .pane.terminal) { width: 100%; }
}

/* Rulebook */
#inspect .pane.rulebook { background: #ece4d2; }
#inspect .rulebook .briefing { font-style: italic; margin: 0 0 14px; padding: 10px 12px; border-left: 3px solid var(--printed); background: rgba(74, 90, 80, 0.07); }
#inspect .rulebook h3 { margin: 18px 0 6px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--printed); border-bottom: 1.5px solid var(--printed); padding-bottom: 3px; }
#inspect .rule { padding: 8px 0 10px; border-bottom: 1px dotted var(--printed); }
#inspect .rule h4 { margin: 0 0 4px; font-size: 18px; }
#inspect .rule p { margin: 0 0 6px; }
#inspect .rule .refs { font-size: 12px; color: var(--printed); }
#inspect .rule .refs a { color: #2f5a8a; }
#inspect .rule.new { background: rgba(176, 122, 30, 0.08); margin: 0 -10px; padding-left: 10px; padding-right: 10px; }
#inspect .badge { font-size: 10px; letter-spacing: 0.08em; background: #b07a1e; color: #fff; padding: 2px 5px; border-radius: 2px; vertical-align: middle; }

/* Citation slips */
#inspect .pane.citation { background: #efd3cc; --band: #7a1a14; }
#inspect .citation .briefing { margin: 0 0 14px; padding: 10px 12px; border-left: 3px solid #7a1a14; background: rgba(122, 26, 20, 0.07); }
#inspect .citation .note { font-style: italic; color: var(--printed); font-size: 14px; margin: 12px 0 0; }

/* The citing procedure in the rulebook */
#inspect .procedure { margin: 0 0 16px; padding: 8px 12px; border: 1.5px solid var(--printed); background: rgba(74, 90, 80, 0.05); }
#inspect .procedure summary { cursor: pointer; font: 14px/1.3 "Russo One", "Arial Black", sans-serif; text-transform: uppercase; letter-spacing: 0.04em; color: var(--printed); }
#inspect .procedure p, #inspect .procedure li { margin: 6px 0; }
#inspect .procedure ol, #inspect .procedure ul { margin: 4px 0; padding-left: 22px; }

/* Session Log (shift 6) */
#inspect .pane.sessions, #inspect .pane.issuers { background: #dde4e6; width: min(900px, 100%); }
#inspect .panes.two-up .pane.sessions { width: min(760px, calc(58% - 10px)); }
#inspect .panes.two-up .pane.document:has(+ .pane.sessions) { width: min(560px, calc(42% - 10px)); }
#inspect .pane.document:has(.letterhead[data-form="MR-1"]) { background: #dde4e6; }
#inspect .sessions td small { display: block; color: var(--printed); font-size: 11px; }
#inspect .sessions tr.completed td { color: var(--printed); text-decoration: line-through; text-decoration-color: rgba(74, 90, 80, 0.5); }
#inspect .sessions tr.completed td[data-field="status"] { text-decoration: none; }
