/* VOLURR — VERIFIED ANALYSIS P3.5 · the Analysis Detail dock.
   ============================================================================================
   Built entirely on the platform's own tokens (css/tokens.css). No new palette, no second design
   language — the detail is a panel of this application, not a guest inside it.

   RTL IS NOT A MIRRORED LTR. The dock sits on the inline-end edge, so it lands on the left in
   Arabic and Kurdish and on the right in English, from ONE declaration. Every value that could
   have been `left` or `right` is written as `inline-start` / `inline-end` for the same reason.

   THE CHART IS NEVER COVERED. Two of the four modes ARE the chart, so the dock reserves width
   beside it rather than floating over it — and below the tablet breakpoint, where reserving width
   would leave the chart unusable, it becomes a bottom sheet instead.
*/

.pcad-dock {
  position: fixed;
  inset-block: 64px 0;
  inset-inline-end: 0;
  width: min(380px, 33vw);
  display: none;
  flex-direction: column;
  z-index: var(--z-overlay, 1000);
  background: var(--card, #0f1422);
  border-inline-start: 1px solid var(--line, #1e2536);
  box-shadow: var(--el-3, 0 10px 40px rgba(0, 0, 0, .45));
  font-family: var(--vt-ui, var(--font-latin, system-ui, sans-serif));
  color: var(--txt, #eef2fa);
}
.pcad-dock.on { display: flex; }

/* The chart gets the remaining width instead of being overlaid. */
body.pcad-on #v-charts { padding-inline-end: min(380px, 33vw); }

/* ── header ─────────────────────────────────────────────────────────────────────────────────── */
.pcad-hd {
  display: flex; align-items: center; gap: var(--sp-5, 12px);
  padding: var(--sp-5, 12px) var(--sp-7, 16px);
  border-block-end: 1px solid var(--line, #1e2536);
  background: var(--bg2, #0b0f1a);
}
.pcad-id { display: flex; flex-direction: column; gap: var(--sp-1, 4px); min-width: 0; flex: 1; }
.pcad-id b {
  font: 600 15px/1.2 var(--vt-mono, var(--font-mono, ui-monospace, monospace));
  letter-spacing: .02em; color: var(--txt, #eef2fa);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  direction: ltr; text-align: start;      /* a symbol pair reads LTR in every locale */
}
.pcad-id span { font-size: 11.5px; color: var(--t-muted, #7a839a); }
.pcad-x {
  flex: none; width: 32px; height: 32px; border-radius: var(--rad-sm, 9px);
  background: transparent; border: 1px solid transparent; color: var(--t-muted, #7a839a);
  font-size: 14px; cursor: pointer; transition: background var(--dur-1, .12s) var(--ease, ease);
}
.pcad-x:hover { background: var(--bg, #070a12); color: var(--txt, #eef2fa); }
.pcad-x:focus-visible { outline: 2px solid var(--brand, #e23b3b); outline-offset: 2px; }

/* ── tabs ───────────────────────────────────────────────────────────────────────────────────── */
.pcad-tabs {
  display: flex; gap: var(--sp-1, 4px); padding: var(--sp-3, 8px) var(--sp-5, 12px) 0;
  border-block-end: 1px solid var(--line, #1e2536);
  /* SIX LABELS DO NOT ALWAYS FIT, AND THE ROW MUST NOT DEAL WITH THAT BY WRAPPING ONE OF THEM.
     Measured on the owner's own screen: "X-Ray" broke at its hyphen into "X-" over "Ray", which
     made that one tab two lines tall against a line-height of 1 and pushed the whole row out of
     alignment. A hyphen is a break opportunity, so the narrowest label was the first to go.
     The row scrolls instead — a contained scroller, never the page — so every label stays whole
     and readable at any width rather than one of them being quietly disfigured. */
  overflow-x: auto; scrollbar-width: none;
}
.pcad-tabs::-webkit-scrollbar { display: none; }
.pcad-tab {
  flex: 1 0 auto; min-inline-size: 0; white-space: nowrap;
  padding: var(--sp-3, 8px) var(--sp-2, 6px); min-height: 40px;
  background: transparent; border: 0; border-block-end: 2px solid transparent;
  color: var(--t-muted, #7a839a); font: 500 12.5px/1 var(--vt-ui, system-ui, sans-serif);
  cursor: pointer; transition: color var(--dur-1, .12s) var(--ease, ease);
}
.pcad-tab:hover:not(.dead) { color: var(--txt, #eef2fa); }
.pcad-tab.on { color: var(--brand, #e23b3b); border-block-end-color: var(--brand, #e23b3b); }
.pcad-tab:focus-visible { outline: 2px solid var(--brand, #e23b3b); outline-offset: -2px; }
/* A mode that does not exist for this analysis stays VISIBLE and inert — hiding it would answer
   the reader's question by pretending they never asked it. */
.pcad-tab.dead { opacity: .38; cursor: not-allowed; text-decoration: line-through; }

/* ── body ───────────────────────────────────────────────────────────────────────────────────── */
.pcad-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: var(--sp-7, 16px); display: flex; flex-direction: column; gap: var(--sp-5, 12px);
}
.pcad-load { padding: var(--sp-9, 24px); text-align: center; color: var(--t-muted, #7a839a); font-size: 13px; }

.pcad-grid { display: flex; flex-direction: column; gap: 1px; background: var(--line, #1e2536);
             border: 1px solid var(--line, #1e2536); border-radius: var(--rad-md, 10px); overflow: hidden; }
.pcad-row {
  display: flex; align-items: baseline; gap: var(--sp-5, 12px);
  padding: 9px var(--sp-5, 12px); background: var(--bg2, #0b0f1a);
}
.pcad-row > span { flex: 1; font-size: 12px; color: var(--t-muted, #7a839a); min-width: 0; }
.pcad-row > b {
  font: 500 12.5px/1.35 var(--vt-mono, var(--font-mono, ui-monospace, monospace));
  color: var(--txt, #eef2fa); text-align: end;
  font-variant-numeric: tabular-nums;     /* figures line up down the column */
  word-break: break-all;
}
.pcad-row > b.ok { color: var(--up, #13A496); }
.pcad-row > b.bad { color: var(--down, #D60400); }

/* ── notes ──────────────────────────────────────────────────────────────────────────────────── */
.pcad-note {
  border-radius: var(--rad-md, 10px); padding: var(--sp-5, 12px);
  border: 1px solid var(--line, #1e2536); background: var(--bg2, #0b0f1a);
  border-inline-start-width: 3px;
}
.pcad-note b { display: block; font-size: 12.5px; margin-block-end: var(--sp-1, 4px); }
.pcad-note p { margin: 0; font-size: 12px; line-height: 1.55; color: var(--t-secondary, #bcc5d8); }
.pcad-note.ok { border-inline-start-color: var(--up, #13A496); }
.pcad-note.ok b { color: var(--up, #13A496); }
.pcad-note.warn { border-inline-start-color: var(--warn, #f59e0b); }
.pcad-note.warn b { color: var(--warn, #f59e0b); }
.pcad-note.muted { border-inline-start-color: var(--line-3, #1e2536); }
.pcad-note.muted b { color: var(--t-muted, #7a839a); }

/* ── replay controls ────────────────────────────────────────────────────────────────────────── */
.pcad-rp { display: flex; flex-direction: column; gap: var(--sp-5, 12px); }
.pcad-rpcur {
  display: flex; align-items: baseline; gap: var(--sp-3, 8px); flex-wrap: wrap;
  padding: var(--sp-5, 12px); border-radius: var(--rad-md, 10px);
  background: var(--bg2, #0b0f1a); border: 1px solid var(--line, #1e2536);
}
.pcad-rpcur > span { font-size: 11.5px; color: var(--t-muted, #7a839a); }
.pcad-rpcur > b {
  font: 600 13px/1 var(--vt-mono, var(--font-mono, ui-monospace, monospace));
  font-variant-numeric: tabular-nums; color: var(--txt, #eef2fa);
}
.pcad-rpcur > em { font-style: normal; font-size: 11.5px; color: var(--brand, #e23b3b);
                   font-variant-numeric: tabular-nums; }
.pcad-rpbtns { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3, 8px); }
.pcad-btn {
  min-height: 40px; padding: var(--sp-3, 8px) var(--sp-4, 10px); border-radius: var(--rad-sm, 9px);
  background: var(--bg2, #0b0f1a); border: 1px solid var(--line, #1e2536);
  color: var(--txt, #eef2fa); font: 500 12.5px/1.2 var(--vt-ui, system-ui, sans-serif);
  cursor: pointer; transition: border-color var(--dur-1, .12s) var(--ease, ease);
}
.pcad-btn:hover { border-color: var(--brand, #e23b3b); }
.pcad-btn:focus-visible { outline: 2px solid var(--brand, #e23b3b); outline-offset: 2px; }
.pcad-rpspd { display: flex; gap: var(--sp-3, 8px); }
.pcad-spd {
  flex: 1; min-height: 34px; border-radius: var(--rad-sm, 9px);
  background: transparent; border: 1px solid var(--line, #1e2536);
  color: var(--t-muted, #7a839a); font: 500 12px/1 var(--vt-mono, monospace);
  cursor: pointer; direction: ltr;
}
.pcad-spd.on { color: var(--brand, #e23b3b); border-color: var(--brand, #e23b3b); }
.pcad-spd:focus-visible { outline: 2px solid var(--brand, #e23b3b); outline-offset: 2px; }

/* ── verdict + timeline ─────────────────────────────────────────────────────────────────────── */
.pcad-verdict {
  padding: var(--sp-7, 16px); border-radius: var(--rad-md, 10px);
  background: var(--bg2, #0b0f1a); border: 1px solid var(--line, #1e2536);
  border-inline-start: 3px solid var(--line-3, #1e2536);
}
.pcad-verdict b { display: block; font: 600 15px/1.2 var(--vt-mono, monospace); letter-spacing: .02em; }
.pcad-verdict p { margin: 6px 0 0; font-size: 12px; line-height: 1.55; color: var(--t-secondary, #bcc5d8); }
/* An ambiguous verdict is NOT coloured as a near-miss. INDETERMINATE and DATA_INCOMPLETE stay
   neutral, because tinting them toward red or green is the interface asserting a certainty the
   engine refused to state. */
.pcad-verdict.ok { border-inline-start-color: var(--up, #13A496); } .pcad-verdict.ok b { color: var(--up, #13A496); }
.pcad-verdict.bad { border-inline-start-color: var(--down, #D60400); } .pcad-verdict.bad b { color: var(--down, #D60400); }
.pcad-verdict.live { border-inline-start-color: var(--brand, #e23b3b); } .pcad-verdict.live b { color: var(--brand, #e23b3b); }
.pcad-verdict.muted b { color: var(--t-muted, #7a839a); }

.pcad-tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px;
           background: var(--line, #1e2536); border: 1px solid var(--line, #1e2536);
           border-radius: var(--rad-md, 10px); overflow: hidden; }
.pcad-tli {
  display: flex; align-items: baseline; gap: var(--sp-3, 8px);
  padding: 9px var(--sp-5, 12px); background: var(--bg2, #0b0f1a); cursor: pointer;
  transition: background var(--dur-1, .12s) var(--ease, ease);
}
.pcad-tli:hover { background: var(--bg, #070a12); }
.pcad-tli b { flex: 1; font-size: 12px; color: var(--txt, #eef2fa); }
.pcad-tli span { font: 400 11.5px/1 var(--vt-mono, monospace); color: var(--t-muted, #7a839a);
                 font-variant-numeric: tabular-nums; }
.pcad-tli em { font-style: normal; font: 500 11.5px/1 var(--vt-mono, monospace);
               color: var(--brand, #e23b3b); font-variant-numeric: tabular-nums; }

.pcad-act { display: flex; gap: var(--sp-3, 8px); }
.pcad-act .pcad-btn { flex: 1; }

/* ── responsive ─────────────────────────────────────────────────────────────────────────────
   Below the tablet breakpoint a side dock would leave the chart too narrow to read, so the panel
   becomes a bottom sheet: the chart keeps the full width and gives up height instead. */
@media (max-width: 900px) {
  .pcad-dock {
    inset: auto 0 0 0; width: auto; max-height: 58vh;
    border-inline-start: 0; border-block-start: 1px solid var(--line, #1e2536);
    border-start-start-radius: var(--rad-lg, 14px); border-start-end-radius: var(--rad-lg, 14px);
  }
  body.pcad-on #v-charts { padding-inline-end: 0; padding-block-end: 58vh; }
  .pcad-rpbtns { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .pcad-dock { max-height: 64vh; }
  body.pcad-on #v-charts { padding-block-end: 64vh; }
  .pcad-body { padding: var(--sp-5, 12px); }
}
/* A coarse pointer gets the platform's touch-target floor on every control. */
@media (pointer: coarse) {
  .pcad-btn, .pcad-tab, .pcad-x { min-height: 44px; }
  .pcad-spd { min-height: 40px; }
  .pcad-tli { padding-block: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .pcad-dock, .pcad-btn, .pcad-tab, .pcad-x, .pcad-tli { transition: none; }
}

/* ── light theme ────────────────────────────────────────────────────────────────────────────
   The platform stamps a theme on the root; every colour above already comes from a token, so this
   only needs the surfaces that would otherwise inherit a dark default from their fallback. */
:root[data-theme="light"] .pcad-dock,

/* == X-RAY  [P7] =============================================================================== */
/* The origin chip is the point of this view, so it is the one element allowed to carry colour on
   its own. It is never colour ALONE: each chip states its origin in words, so the distinction
   survives a monochrome screen and a reader who cannot separate the hues (P7.17). */
/* `flex-shrink: 0` IS LOAD-BEARING. `.pcad-body` is a flex column, so every section here is a flex
   child that defaults to shrinking — with seven of them the browser squeezed each one and clipped
   its rows in half rather than letting the body scroll, which is exactly what the body's
   `overflow-y: auto` is for. Measured on the Arabic panel at 1540x900: rows lost their lower half.
   The same applies to the certificate blocks below. */
.pcad-xrsec { display: flex; flex-direction: column; gap: 1px; flex: 0 0 auto;
              background: var(--line, #1e2536); border: 1px solid var(--line, #1e2536);
              border-radius: var(--rad-md, 10px); overflow: hidden; }
.pcad-xrsec h4 {
  margin: 0; padding: 8px var(--sp-5, 12px); background: var(--bg2, #0b0f1a);
  font: 600 11px/1.4 inherit; letter-spacing: .06em; text-transform: uppercase;
  color: var(--t-muted, #7a839a);
}
.pcad-xr {
  display: flex; align-items: baseline; gap: var(--sp-3, 8px);
  padding: 9px var(--sp-5, 12px); background: var(--bg2, #0b0f1a);
}
.pcad-xr.abs { opacity: .72; }
.pcad-xrk { flex: 1; min-width: 0; font-size: 12px; color: var(--t-muted, #7a839a); }
.pcad-xrv {
  font: 500 12.5px/1.35 var(--vt-mono, var(--font-mono, ui-monospace, monospace));
  color: var(--txt, #eef2fa); text-align: end;
  font-variant-numeric: tabular-nums; word-break: break-all; max-width: 46%;
}
.pcad-org {
  flex: 0 0 auto; font-style: normal; font-size: 10.5px; line-height: 1;
  padding: var(--sp-1, 4px) var(--sp-2, 6px); border-radius: var(--rad-pill, 999px); white-space: nowrap;
  border: 1px solid var(--line-3, #1e2536); color: var(--t-muted, #7a839a);
}
.pcad-org.cap { border-color: color-mix(in srgb, var(--up, #13A496) 45%, transparent);
                color: var(--up, #13A496); }
.pcad-org.der { border-color: color-mix(in srgb, var(--brand, #e23b3b) 45%, transparent);
                color: var(--brand, #e23b3b); }
.pcad-xrnote { margin: 0; padding: 8px var(--sp-5, 12px); background: var(--bg2, #0b0f1a);
               font-size: 11.5px; line-height: 1.5; color: var(--t-muted, #7a839a); }

/* == CERTIFICATE  [P7] ========================================================================= */
.pcad-cert { display: flex; flex-direction: column; gap: var(--sp-5, 12px); flex: 0 0 auto; }
.pcad-cert > * { flex: 0 0 auto; }
.pcad-certhd {
  display: flex; align-items: center; gap: var(--sp-5, 12px);
  padding: var(--sp-5, 12px) var(--sp-7, 16px);
  border: 1px solid var(--line, #1e2536); border-radius: var(--rad-md, 10px);
  background: var(--bg2, #0b0f1a);
}
.pcad-certmark {
  flex: 0 0 auto; inline-size: 30px; block-size: 30px; border-radius: var(--rad-pill, 999px);
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
  color: var(--up, #13A496);
  border: 1px solid color-mix(in srgb, var(--up, #13A496) 45%, transparent);
  background: color-mix(in srgb, var(--up, #13A496) 10%, transparent);
}
.pcad-certhd > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1, 4px); }
.pcad-certhd b { font-size: 13px; color: var(--txt, #eef2fa); }
.pcad-certhd span { font-size: 11.5px; color: var(--t-muted, #7a839a); }
.pcad-certres {
  flex: 0 0 auto; font-style: normal; font-size: 12px; font-weight: 600;
  padding: var(--sp-2, 6px) var(--sp-4, 10px); border-radius: var(--rad-pill, 999px); white-space: nowrap;
  border: 1px solid var(--line-3, #1e2536); color: var(--t-muted, #7a839a);
}
.pcad-certres.ok { color: var(--up, #13A496);
                   border-color: color-mix(in srgb, var(--up, #13A496) 45%, transparent); }
.pcad-certres.bad { color: var(--down, #D60400);
                    border-color: color-mix(in srgb, var(--down, #D60400) 45%, transparent); }
.pcad-certres.live { color: var(--warn, #f59e0b);
                     border-color: color-mix(in srgb, var(--warn, #f59e0b) 45%, transparent); }
.pcad-cert h4 {
  margin: 0; font: 600 11px/1.4 inherit; letter-spacing: .06em; text-transform: uppercase;
  color: var(--t-muted, #7a839a);
}
/* THE HASH IS THE ONE THING A READER MIGHT COPY, so it wraps rather than truncating: a fingerprint
   shown as an ellipsis cannot be checked against anything. */
.pcad-hash {
  display: flex; flex-direction: column; gap: var(--sp-2, 6px); flex: 0 0 auto;
  padding: var(--sp-5, 12px); border: 1px solid var(--line, #1e2536);
  border-radius: var(--rad-md, 10px); background: var(--bg2, #0b0f1a);
}
.pcad-hash span { font-size: 11px; color: var(--t-muted, #7a839a); }
.pcad-hash code {
  font: 500 11.5px/1.5 var(--vt-mono, var(--font-mono, ui-monospace, monospace));
  color: var(--txt, #eef2fa); word-break: break-all; user-select: all;
}

/* Narrow screens: the origin chip drops below the value rather than squeezing the label to nothing
   (P7.16 - a row that reflows is readable, a row that clips is not). */
@media (max-width: 560px) {
  .pcad-xr { flex-wrap: wrap; }
  .pcad-xrv { max-width: none; flex: 1; text-align: start; }
  .pcad-org { order: 3; }
  .pcad-certhd { flex-wrap: wrap; }
  .pcad-certres { order: 3; width: 100%; text-align: center; }
}

:root[data-theme="light"] .pcad-hd,
:root[data-theme="light"] .pcad-row,
:root[data-theme="light"] .pcad-note,
:root[data-theme="light"] .pcad-rpcur,
:root[data-theme="light"] .pcad-verdict,
:root[data-theme="light"] .pcad-tli { background: var(--card); color: var(--txt); }

:root[data-theme="light"] .pcad-xrsec h4,
:root[data-theme="light"] .pcad-xr,
:root[data-theme="light"] .pcad-xrnote,
:root[data-theme="light"] .pcad-certhd,
:root[data-theme="light"] .pcad-hash { background: var(--card); color: var(--txt); }
