/* Evidence tools: image editor (.ann) and text evidence viewer (.tv), both rendered inside #viewer. */
#viewer:has(> .ann) { width: min(1320px, calc(100% - 24px)); max-width: calc(100% - 24px); height: min(92vh, 960px); max-height: min(92vh, 960px); }
#viewer:has(> .tv) { width: min(1200px, calc(100% - 24px)); max-width: calc(100% - 24px); height: min(88vh, 900px); }
.ann, .tv { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; min-height: 0; }
.ann:focus { outline: none; }
.ann > .modal-head, .tv > .modal-head { align-items: center; padding-top: 16px; padding-bottom: 12px; }
.ann-title, .tv-title { min-width: 0; }
.ann-title h2, .tv-title h2 { margin-top: 4px; font-size: 1.05rem; }
.ann > .modal-head > .row, .tv-actions { flex: none; flex-wrap: nowrap; gap: 8px; }
.ann-bar, .tv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; padding: 0 26px 12px; }

/* ---------- Image editor ---------- */
.ann svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ann svg .fs { fill: currentColor; stroke: none; }
.ann svg .fa { fill: currentColor; fill-opacity: .35; stroke: none; }
.ann-bar .seg button { display: inline-grid; place-items: center; min-width: 38px; min-height: 36px; padding: 6px 8px; }
.ann-bar .seg button:hover { color: var(--ink); }
.ann-colors .chip { width: 36px; min-height: 36px; padding: 0; justify-content: center; }
.c-red { --ann-bg: #ff3b4e; --ann-fg: #fff; }
.c-amber { --ann-bg: #ffb020; --ann-fg: #1f1400; }
.c-cyan { --ann-bg: #22d3ee; --ann-fg: #00171d; }
.c-white { --ann-bg: #fff; --ann-fg: #0b1620; }
.ann-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--ann-bg); box-shadow: 0 0 0 1px #00000066; }
.ann-w { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.ann-w.big { height: 5px; }
.ann-acts { display: flex; gap: 4px; margin-left: auto; }
.ann-acts .btn.icon.sm { min-width: 36px; min-height: 36px; }
.ann-stage { position: relative; flex: 1 1 0; min-height: 0; display: grid; place-items: center; margin: 0 26px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--deep); user-select: none; -webkit-user-select: none; }
.ann-canvas { display: block; max-width: 100%; max-height: 100%; touch-action: none; cursor: crosshair; background: repeating-conic-gradient(#0d2132 0 25%, #08151f 0 50%) 0 0 / 16px 16px; box-shadow: 0 0 0 1px var(--line-soft), 0 10px 30px #00000066; }
.ann-canvas:focus { outline: none; }
.ann-canvas:focus-visible { outline: 1px solid #7ecfff80; outline-offset: 3px; }
.ann-stage[data-mode=text] .ann-canvas { cursor: text; }
.ann .ann-stage input.ann-text { position: absolute; z-index: 2; width: 16em; max-width: calc(100% - 8px); min-height: 0; padding: .15em .45em; border: 0; border-radius: 6px; background: var(--ann-bg); color: var(--ann-fg); font-weight: 600; line-height: 1.35; box-shadow: 0 0 0 2px #7ecfffaa, 0 6px 20px #00000088; }
.ann .ann-stage input.ann-text::placeholder { color: inherit; opacity: .6; }
.ann-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 58px; padding: 10px 26px 14px; }
.ann-crop { display: flex; gap: 8px; }
.ann-dims { margin-left: auto; color: var(--muted); font: 11px var(--mono); white-space: nowrap; }

/* ---------- Text evidence ---------- */
.tv-sum { margin-left: auto; font-family: var(--mono); }
.tv-sum:empty { display: none; }
.tv-body { flex: 1 1 auto; }
.tv-code, .tv-diff { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--deep); color: #c6dcee; font: 12.5px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
.tv-code { padding: 10px 14px 10px 0; }
.tv-l { position: relative; min-height: 1.6em; padding-left: 6ch; }
.tv-l::before { content: attr(data-n); position: absolute; left: 0; width: 4.5ch; color: #5d7a90; text-align: right; }
.tv-method { color: var(--good); font-weight: 700; }
.tv-url { color: var(--ink); }
.tv-ver, .tv-time, .tv-lv-dbg, .tv-more { color: var(--muted); }
.tv-st { font-weight: 700; }
.tv-s1, .tv-s3 { color: var(--accent); }
.tv-s2 { color: var(--good); }
.tv-s4, .tv-lv-warn { color: var(--warn); }
.tv-s5, .tv-lv-err { color: var(--bad); }
.tv-lv-err, .tv-lv-warn { font-weight: 700; }
.tv-hn, .tv-key, .tv-tag, .tv-lv-info { color: var(--accent); }
.tv-str { color: #a6e3c8; }
.tv-num, .tv-attr { color: var(--warn); }
.tv-bool, .tv-null { color: var(--violet); }
.tv-com, .tv-more { font-style: italic; }
.tv-com { color: var(--muted); }
mark.tv-red { padding: 0 2px; border-radius: 3px; background: #ff8fa026; color: var(--bad); }
.tv-note { padding: 10px 2px 0; }
.tv-diff { overflow: clip; }
.tv-dh, .tv-dr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tv-dh { position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); background: var(--panel2); font: 600 11px/1.5 var(--mono); }
.tv-dh span { min-width: 0; padding: 8px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-dl { color: var(--bad); }
.tv-da { color: var(--good); }
.tv-dr > .tv-l { padding: 0 10px 0 8ch; }
.tv-dr > .tv-l::before { width: 6.5ch; }
.tv-dr > :last-child { border-left: 1px solid var(--line-soft); }
.tv-l.del { background: #ff8fa01a; }
.tv-l.add { background: #5dffd814; }
.tv-l.del::before { content: '− ' attr(data-n); color: var(--bad); }
.tv-l.add::before { content: '+ ' attr(data-n); color: var(--good); }
.tv-nil { background: repeating-linear-gradient(135deg, transparent 0 6px, #ffffff07 6px 12px); }
.tv-clip { position: fixed; top: 0; left: 0; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none; }

@media (max-width: 720px) {
  #viewer:has(> .ann), #viewer:has(> .tv) { width: calc(100% - 16px); max-width: calc(100% - 16px); height: 94vh; height: 94dvh; max-height: 94dvh; }
  .ann > .modal-head, .tv > .modal-head { gap: 10px; padding: 12px 14px 10px; }
  .ann-bar, .tv-bar { gap: 8px; padding: 0 14px 10px; }
  .ann-bar .seg button { min-width: 34px; padding: 6px; }
  .ann-stage { margin: 0 14px; }
  .ann-foot { min-height: 50px; padding: 8px 14px 12px; }
  .ann-foot:has(.ann-crop:not([hidden])) .hint { display: none; }
  .tv-body { padding: 0 14px 14px; }
  .tv-lbl { display: none; }
  .tv-actions .btn.sm { min-width: 38px; padding-inline: 8px; }
  .tv-code, .tv-diff { font-size: 12px; }
  .tv-l { padding-left: 5ch; }
  .tv-l::before { width: 3.6ch; }
  .tv-dh, .tv-dr { grid-template-columns: minmax(0, 1fr); }
  .tv-dh span + span { border-top: 1px solid var(--line-soft); }
  .tv-dr.same > :last-child, .tv-nil { display: none; }
  .tv-dr > :last-child { border-left: 0; }
}
