/* Context Drift Heatmap: page-specific styles. Shared primitives live in ds.css, tools.css and ai-tools.css.
 * Heat cells mix the page material (--m) into --page-2 by a 0 to 80 percent share, so the lowest value is
 * the empty page colour and the highest is the material colour with dark ink printed on top. */
#results { display: grid; gap: 18px; min-width: 0; }
#results[hidden] { display: none; }
.ait-tl-seg { margin-bottom: 12px; }
.ait-tl-seg button { min-height: 40px; }
.ait-tl-wrap { position: relative; padding: 0 44px 0 0; }
.ait-tl-frame { position: relative; height: 160px; border: 2px solid var(--line-2); background: #fff; }
.ait-tl { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 1px; padding: 0 1px; }
.ait-tl-bar { flex: 1 1 0; min-width: 1px; height: var(--bh, 0%); background: var(--m); }
.ait-tl-bar.is-mid { background: var(--m-side); }
.ait-tl-bar.is-over { background: var(--bad); }
.ait-tl-marks { position: absolute; inset: 0; pointer-events: none; }
.ait-tl-mark { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--ink-3); }
.ait-tl-lab { position: absolute; right: -42px; top: -8px; font: 800 11px/1 var(--font-ui); color: var(--ink-2); }
.ait-tl-wrap.is-tokens .ait-tl-marks { display: none; }

.ait-chk { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 6px; font-size: 14.5px; font-weight: 700; color: var(--ink); min-height: 40px; }
.ait-chk input { width: 20px; height: 20px; margin-top: 2px; flex: none; }

.ait-hm-wrap { max-height: 70vh; }
.ait-hm { font-size: 13px; min-width: 760px; }
.ait-hm caption, .ait-ledger caption, .ait-sig caption { caption-side: top; text-align: left; padding: 10px 13px 8px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.ait-hm thead th { position: sticky; top: 0; z-index: 1; }
.ait-hm th, .ait-hm td { padding: 8px 10px; }
.ait-hm tbody tr { cursor: pointer; }
.ait-hm tbody tr:focus-visible { outline: 3px solid var(--m-ink); outline-offset: -3px; }
.ait-hm tbody tr.is-sel td { box-shadow: inset 0 3px 0 var(--m); }
.ait-hm tbody tr.is-mid td:first-child { border-left: 4px solid var(--m-side); }
.ait-hm td.num, .ait-hm th.num { font-variant-numeric: tabular-nums; }
.ait-hm .chip { font-size: 12px; padding: 2px 7px; }
.ait-prev { display: block; max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ait-hc { font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--m) var(--h, 0%), var(--page-2)); color: var(--ink); font-weight: 750; }
.ait-na { color: var(--ink-3); }

.ait-ledger td, .ait-sig td { vertical-align: top; font-size: 13.5px; }
.ait-ledger td:first-child, .ait-sig td:last-child { white-space: normal; min-width: 220px; overflow-wrap: anywhere; }
.ait-ledger th, .ait-ledger td, .ait-sig th, .ait-sig td { white-space: normal; }
.ait-note { font-size: 13px; color: var(--ink-3); max-width: 78ch; line-height: 1.5; margin: 6px 0; }
.ait-dots { display: flex; flex-wrap: wrap; gap: 4px; min-width: 120px; }
.ait-dot { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font-size: 13px; font-weight: 900; line-height: 1; }
.ait-dot.ok { background: var(--ok-soft); border-color: var(--ok); color: #0f5a2c; }
.ait-dot.fail { background: var(--bad-soft); border-color: var(--bad); color: #7a1d17; }
.ait-dot.na { background: var(--page-2); border-color: var(--line-2); color: var(--ink-3); }

.ait-detail { scroll-margin-top: 90px; }
.ait-detail h4 { font: 800 0.95rem/1.3 var(--display); margin: 16px 0 6px; color: var(--ink); }
.ait-turn-text { white-space: pre-wrap; overflow-wrap: anywhere; font: 500 14px/1.6 var(--font-ui); color: var(--ink); max-height: 360px; overflow: auto; border: 2px solid var(--line-2); padding: 12px 14px; background: #fff; }
.ait-rng-issued { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 750; }
.ait-rng-bad { background: var(--bad-soft); color: #7a1d17; }
.ait-rng-sig { background: var(--warn-soft); color: #5f3d00; }
#detail-h:focus { outline: 3px solid var(--m-ink); outline-offset: 2px; }
.ait-detail .card-h { justify-content: space-between; }
.ait-detail .card-h h3 { margin-right: auto; }
.ait-detail .plain li { font-size: 14px; }

#tips li { font-size: 14.5px; }
.prose .tbl { width: 100%; }
.prose .tbl th, .prose .tbl td { padding: 8px 10px; font-size: 14px; }
.ait-meta { margin: 8px 0 0; }
.ait-drop small { display: block; font-weight: 600; color: var(--ink-3); margin-top: 4px; }
.ait-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ait-drop { position: relative; }
.ait-drop:focus-within { border-color: var(--m); background: var(--m-soft); }
.ait-status:empty { min-height: 0; }

.msg-warn i { background: var(--sand); }

@media (max-width: 600px) {
  .ait-tl-wrap { padding-right: 40px; }
  .ait-tl-lab { right: -38px; }
  .ait-hm-wrap { max-height: 60vh; }
  .ait-chk { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .ait-tl-bar, .ait-chk input { transition: none !important; }
}
