/* ============================================================
   PAWlyzer — design tokens from CLAUDE.md (fidelity: high)
   ============================================================ */
:root {
  /* The design tokens are final (light) — opt out of browser auto-dark. */
  color-scheme: only light;

  /* Red Tenant look & feel: ink, vermilion for structure (header
     rule, hover, focus, overlay edges), violet for the productive
     tenant. Severity colours below stay separate from the accent. */
  --navy-900: #000520;
  --navy-700: #2a2e45;
  --navy-200: #b3b5c2;
  --navy-100: #cccdd6;
  --accent: #e44418;
  --accent-dark: #c2360f;
  --accent-tint: #fff1ec;
  --violet: #543b9c;
  --brand-red: #e44418;

  --red: #d6294f;
  --red-dark: #b0203c;
  --orange: #e8632c;
  --amber: #c9920a;
  --blue: #4d84ad;
  --blue-dark: #2f5a82;
  --blue-mid: #6f93bd;

  --tint-red: #fdecef;
  --tint-red-2: #f8d3dd;
  --tint-orange: #fbe4d4;
  --tint-orange-2: #fbdcc7;
  --tint-amber: #fff3d1;
  --tint-amber-2: #fdf0c8;
  --tint-amber-3: #fdeebb;
  --tint-blue: #e7eef5;
  --tint-blue-2: #cfe0ee;

  --page-bg: #e5e6e9;
  --canvas-bg: #f5f5f5;
  --card-bg: #ffffff;
  --card-border: #e1e2e6;
  --ink-900: #20262f;
  --ink-700: #28303c;
  --ink-600: #4b545f;
  --ink-500: #5a6572;
  --ink-400: #7a828d;
  --ink-300: #8b929c;
  --ink-200: #aab0b8;
  --help-dot: #c9ccd2;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page-bg);
  /* System stack, no webfont: the dashboard must render fully offline /
     air-gapped with zero external requests. */
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink-700);
  overflow: hidden;
}

@keyframes pawPulse { 0%,100% { opacity: .9; } 50% { opacity: .35; } }

/* Fixed 1680x812 design, scaled by JS to fill the display in both
   dimensions (upscaling allowed) and centred via translate. */
.viewport {
  width: 1680px;
  position: absolute; top: 0; left: 0;
  transform-origin: top left;
}
.canvas {
  position: relative;
  width: 1680px;
  height: 812px;
  background: var(--canvas-bg);
  box-shadow: 0 0 0 1px var(--card-border);
  overflow: hidden;
}

.flow-lines { position: absolute; inset: 0; opacity: 1; transition: opacity .3s ease; }
.flow-lines.dimmed { opacity: 0.1; }

/* ============ Header ============ */
.header {
  position: absolute; top: 0; left: 0; right: 0; height: 76px;
  padding: 0 34px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy-900);
  border-bottom: 3px solid var(--accent);
}
.header-left { display: flex; align-items: center; gap: 18px; }
.wordmark { font-size: 30px; font-weight: 900; letter-spacing: -.5px; color: #fff; }
.wordmark-accent { color: var(--brand-red); }
.header-rule { height: 22px; width: 1px; background: var(--navy-700); }
.header-subtitle { font-size: 14px; font-weight: 600; color: var(--navy-200); }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.legend-dot.sm { width: 10px; height: 10px; }

/* Header ring legend — names + live percentages for the four centre
   rings live HERE (per the design spec), not inside the rings: the
   fourth ring leaves too little room in the circle centre. */
.header-legend { display: flex; align-items: center; gap: 22px; }
.header-legend[hidden] { display: none; }
.hl-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--navy-100);
  white-space: nowrap;
}
.hl-val { font-weight: 900; color: #fff; }

/* ============ Columns ============ */
/* Three columns centred on the 1680px canvas:
   396 + 100 gap + 400 + 80 gap + 410 = 1386 → 147px outer margins */
.col { position: absolute; top: 88px; }
.col-left { left: 147px; width: 396px; }
.col-right { left: 1123px; width: 410px; }
.col-centre { position: absolute; left: 643px; top: 98px; width: 400px; display: flex; flex-direction: column; align-items: center; }

.col-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-left: 2px; }
.col-heading > span:first-child { font-size: 20px; font-weight: 800; color: var(--ink-900); }
.help-dot {
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--help-dot); color: #fff;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: help;
}

/* ============ Cards ============ */
.card-stack { display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}
.card-left {
  height: 142px; padding: 14px 16px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.card-right-pad { padding: 15px 17px; margin-bottom: 14px; }
.card-perms { height: 236px; }
.card-b2b, .card-activities { height: 150px; display: flex; flex-direction: column; justify-content: space-between; }
.card-activities { margin-bottom: 0; }

.card-top { display: flex; align-items: center; justify-content: space-between; }
.perms-top { margin-bottom: 12px; }
.card-title-row { display: flex; align-items: center; gap: 10px; }
.icon-tile {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
}
.card-title { font-size: 15.5px; font-weight: 800; }

.badge {
  background: var(--tint-amber); color: var(--amber);
  font-weight: 800; font-size: 14px;
  padding: 3px 11px;
}
.badge-sm { font-size: 13px; padding: 3px 10px; }
.perms-mode {
  height: 27px; min-width: 82px;
  appearance: auto;
  border: 1px solid #e4c968;
  background: var(--tint-amber); color: var(--amber);
  padding: 2px 6px;
  font: inherit; font-size: 13px; font-weight: 800;
  cursor: pointer;
}
.perms-mode:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Device-visibility warning chip — shown when devices Tier0 users
   sign in from are invisible to the card's data source. */
.badge-group { display: flex; align-items: center; gap: 6px; }
.vis-warn {
  background: var(--tint-orange); color: #a1541c;
  font-weight: 800; font-size: 11.5px;
  padding: 3px 8px;
  cursor: help; white-space: nowrap;
}
.vis-warn[hidden] { display: none; }

.caption { font-size: 12.5px; color: var(--ink-400); font-weight: 600; }

/* Per-metric ⓘ — sits beside a mid-number, wired (app.js DETAIL_SPECS)
   to hover/click for just that one figure, narrower than the
   whole-card hover/click on the surrounding .card.has-details.
   align-items: center puts the dot on the mid-number's box center, but
   at 30px/900-weight the digit glyphs themselves sit ~5px above that
   box center (extra reserved space below the baseline outweighs the
   space above the cap-height) — confirmed by rendering both against a
   center guideline. The dot's own margin-top nudges it up to the
   digits' actual visual center rather than the box's geometric one. */
.mid-number-row { display: flex; align-items: center; gap: 4px; }
.metric-info {
  width: 13px; height: 13px; border-radius: 50%;
  border: 0; padding: 0;
  background: var(--help-dot); color: #fff;
  font-family: inherit;
  font-size: 9px; font-weight: 800; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  margin-top: -5px;
}
.metric-info.has-details { cursor: pointer; }
.metric-info.has-details:hover { background: var(--amber); }

.chip-row { display: flex; gap: 8px; }
.chip { flex: 0 0 auto; font-weight: 800; font-size: 12px; padding: 4px 10px; }
.chip-high { background: var(--tint-orange); color: #a1541c; }
.chip-medium { background: var(--tint-amber-2); color: #8a6a06; }
.chip-low { background: var(--tint-blue); color: #33546f; }

.hero-row { display: flex; align-items: baseline; gap: 10px; }
.big-number { font-size: 38px; font-weight: 900; line-height: 1; color: var(--ink-900); }
.mid-number { font-size: 34px; font-weight: 900; line-height: 1; color: var(--ink-900); }

.progress-track { height: 9px; background: var(--canvas-bg); overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--red));
  transition: width .6s ease-out;
}

.figure-row { display: flex; gap: 24px; }
.figure-row.wide { gap: 30px; align-items: flex-end; }
/* Three figures in one card-left (364px of content width): equal columns
   instead of flex so the widest label can't steal room from the others,
   with a smaller label size — at 11.5px "Non-Microsoft Apps installed"
   wraps to three lines and overflows the card's fixed 142px height. */
.figure-row.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.figure-row.trio .mid-number { font-size: 30px; }
.figure-row.trio .micro-label {
  font-size: 9.5px; letter-spacing: .2px; line-height: 1.2; margin-top: 3px;
}
.b2b-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.b2b-number { font-size: 30px; font-weight: 900; line-height: 1; color: var(--ink-900); }
.b2b-metrics .micro-label { margin-top: 3px; line-height: 1.2; }
.micro-label {
  font-size: 11.5px; color: var(--ink-400); font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
}

.kv-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px;
  font-size: 13px; font-weight: 700; color: var(--ink-600);
}
.kv { display: flex; justify-content: space-between; }
.kv-val { color: var(--ink-900); }

/* ============ Centre rings ============ */
/* Scope tag — this column (sign-in coverage, permissions, activity,
   including the alternate Graph API activity view) reflects Microsoft
   365 / Entra tenant data only, not e.g. Azure resource-plane activity. */
.scope-badge {
  display: inline-block;
  background: var(--tint-blue); color: var(--blue-dark);
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase;
  padding: 3px 9px;
  margin-bottom: 8px;
}
.eyebrow {
  font-size: 13px; font-weight: 800; letter-spacing: 1.2px;
  color: var(--ink-300); text-transform: uppercase; margin-bottom: 10px;
}
.rings-wrap { position: relative; width: 360px; height: 360px; }
.rings-svg { position: absolute; inset: 0; }
.rings-svg circle[pathLength] { transition: stroke-dasharray .6s ease-out; }
/* Each ring is its own hover/click target (see index.html) — the
   transparent .ring-hit-area circle is the actual hit band, wide
   enough to hover comfortably; .ring-arc brightens as feedback. */
.ring-hit-area { pointer-events: stroke; }
.ring-hit.has-details { cursor: pointer; }
.ring-hit.has-details:hover .ring-arc { filter: brightness(1.18); }
.alarm-ring { opacity: .5; animation: pawPulse 2.6s ease-in-out infinite; }
.alarm-ring.off { opacity: 0; animation: none; }
@media (prefers-reduced-motion: reduce) {
  .alarm-ring { animation: none; opacity: .35; }
  .rings-svg circle[pathLength] { transition: none; }
  .progress-fill { transition: none; }
}

.rings-centre {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  /* Purely informational overlay covering the whole rings SVG — without
     this it swallows every hover/click meant for the ring hit targets
     underneath. */
  pointer-events: none;
}
.hero-number { font-size: 64px; font-weight: 900; line-height: 1; color: var(--ink-900); }
.hero-label {
  font-size: 13px; font-weight: 800; letter-spacing: 1px;
  color: var(--ink-500); text-transform: uppercase;
}
/* Red-tenant share of the hero number (-RedTenant runs only): mini
   donut + percentage in a square tag with the hatched vermilion frame
   of the Managed Red Tenant boundary. Its own hit target: .rings-centre
   disables pointer events for the rings underneath. */
.hero-red {
  pointer-events: auto;
  margin-top: 8px; padding: 3px 8px 3px 5px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 3px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(-45deg, var(--accent) 0 1px, #fff 1px 3.5px) border-box;
  box-shadow: 0 0 0 1px var(--accent), inset 0 0 0 1px var(--accent);
  white-space: nowrap; line-height: 1;
}
.hero-red[hidden] { display: none; }
.hero-red-donut { width: 18px; height: 18px; flex: none; }
.hero-red-track, .hero-red-arc { fill: none; stroke-width: 4; }
.hero-red-track { stroke: #fbd9cd; }
.hero-red-arc { stroke: var(--accent); transition: stroke-dasharray .9s ease; }
.hero-red-pct { font-size: 13px; font-weight: 900; color: var(--accent-dark); }
.hero-red-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px; font-weight: 700; letter-spacing: .4px;
  color: var(--ink-900); text-transform: uppercase;
}
.hero-red.has-details { cursor: pointer; transition: background .15s ease; }
.hero-red.has-details:hover {
  background:
    linear-gradient(var(--accent-tint), var(--accent-tint)) padding-box,
    repeating-linear-gradient(-45deg, var(--accent) 0 1px, #fff 1px 3.5px) border-box;
}
.hero-red.has-details:focus-visible { outline: 2px solid var(--navy-900); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .hero-red-arc { transition: none; } }

/* Device strip — between the rings and the score row: the devices
   Tier0 admins sign in from, split by Entra join type (Entra
   ID-joined / registered / unknown), with a warning line for sign-ins
   from unknown devices and known devices not protected in Defender.
   Turns red when every sign-in lacks a device identity:
   administration happens only from unknown devices. */
.device-strip {
  margin-top: 8px; width: 400px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 8px 14px 9px;
}
.ds-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ds-eyebrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  color: var(--ink-300); text-transform: uppercase;
}
.ds-total { font-size: 12px; font-weight: 900; color: var(--ink-900); }
.ds-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: 5px;
}
.ds-num { font-size: 20px; font-weight: 900; line-height: 1; color: var(--ink-900); }
.ds-stat .micro-label { margin-top: 2px; font-size: 10px; line-height: 1.2; }
/* Warning line — orange while something is unprotected/unknown,
   muted when everything checks out. */
.ds-warning {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--card-border);
  font-size: 11px; font-weight: 700; line-height: 1.3; color: #a1541c;
}
.ds-warning[hidden] { display: none; }
.ds-warning.ok { color: var(--ink-400); }
/* One warning per line — entries must never run together. */
.ds-warning-line + .ds-warning-line { margin-top: 2px; }
.device-strip.has-details:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.device-strip.risk { background: var(--tint-red); border: 1.5px solid #e58ba3; }
.device-strip.risk .ds-num,
.device-strip.risk .ds-total { color: #a71e46 !important; }
.device-strip.risk .ds-eyebrow { color: #a71e46; opacity: .75; }
.device-strip.risk .ds-warning { color: #a71e46; border-top-color: #e58ba3; }

/* N/A state — device-scoped card with no Tier0-related devices to
   measure. Numbers are dimmed AND shrunk: N/A is an absence, not a
   figure, and must not carry hero-number weight. */
.card.na .big-number, .card.na .mid-number, .card.na .kv-val { color: var(--ink-200) !important; }
.card.na .big-number, .card.na .mid-number {
  font-size: 18px; font-weight: 800; letter-spacing: .3px;
}
.card.na .badge { background: var(--canvas-bg); color: var(--ink-300); }
.card.na .progress-fill { opacity: 0; }

/* Score cards */
.score-row { margin-top: 9px; width: 400px; display: flex; align-items: stretch; gap: 10px; }
.score-card-mid { text-align: center; }
.score-num-row.mid { justify-content: center; }
.score-card {
  flex: 1; background: var(--card-bg); border: 1px solid var(--card-border); padding: 11px 14px;
}
.score-eyebrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  color: var(--ink-300); text-transform: uppercase; white-space: nowrap;
}
.score-card-right .score-eyebrow, .score-card-right .score-caption { text-align: right; }
.score-num-row { display: flex; align-items: baseline; gap: 4px; }
.score-num-row.right { justify-content: flex-end; }
.score-number { font-size: 30px; font-weight: 900; line-height: 1; }
.score-suffix { font-size: 13px; font-weight: 700; color: var(--ink-200); }
.score-caption { font-size: 11px; color: var(--ink-400); font-weight: 600; line-height: 1.25; margin-top: 2px; }

.verdict-pill {
  margin-top: 9px;
  background: var(--red); color: #fff;
  font-weight: 900; font-size: 14px; letter-spacing: .8px;
  padding: 9px 26px;
}
.verdict-pill.sev-high { background: var(--orange); }
.verdict-pill.sev-medium { background: var(--amber); }
.verdict-pill.sev-low { background: var(--blue); }

/* ============ Right column bars ============ */
.bar-list { display: flex; flex-direction: column; gap: 9px; }
.perms-empty {
  font-size: 12.5px; font-weight: 600; color: var(--ink-400);
  line-height: 1.5; padding: 26px 8px 0; text-align: center;
}
.perms-empty code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: var(--ink-600);
  background: var(--canvas-bg); padding: 1px 5px;
}
.bar-item-head {
  display: flex; justify-content: space-between;
  font-size: 13px; font-weight: 700; margin-bottom: 3px;
}
.bar-track { height: 7px; background: var(--canvas-bg); }
.bar-fill { height: 100%; transition: width .6s ease-out; }

/* Graph-API operations line — fills the gap between the Privileged
   Activities title and its CREATE/WRITE/DELETE tiles with the
   GraphAPIAuditEvents total (the alternate lens the hover top-URI
   lists are built from). */
.graph-ops-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 3px 2px;
  border-bottom: 1px dashed var(--card-border);
}
.graph-ops-row[hidden] { display: none; }
.graph-ops-label {
  font-size: 11px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; color: var(--ink-400);
  text-decoration: underline dotted; text-underline-offset: 2px;
}
.graph-ops-val { font-size: 15px; font-weight: 900; color: var(--ink-900); }

.tile-row { display: flex; gap: 8px; }
.tile { flex: 1; padding: 8px 10px; }
.tile-num { font-size: 22px; font-weight: 900; line-height: 1; }
.tile-label { font-size: 11px; font-weight: 800; color: var(--ink-300); }

/* Boxes/rows carrying a hover explanation (native title attribute) —
   same "hover for more" affordance as .help-dot, applied inline via a
   dotted underline instead of a separate icon so it doesn't crowd a
   small tile or list row. */
.has-desc { cursor: help; }
.tile.has-desc .tile-label { text-decoration: underline dotted; text-underline-offset: 2px; }
.panel-entry.has-desc .entry-label { text-decoration: underline dotted; text-underline-offset: 2px; }

/* ============ Footer bar (freshness + flags) ============ */
.footer-bar {
  width: 1680px; margin-top: 10px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px;
}
.freshness { font-size: 12.5px; font-weight: 600; color: var(--ink-400); }
.flag-controls { display: flex; gap: 18px; }
.flag {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--ink-500);
  cursor: pointer; user-select: none;
}
.flag input { accent-color: var(--navy-900); margin: 0; }

/* ============ Interactive metrics ============ */
.has-details { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.card.has-details:hover,
.score-card.has-details:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.score-card.has-details:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
  border-color: var(--accent);
}
/* Header legend rows double as (larger, easier-to-hit) alternates for
   the same per-ring hover/click targets. */
.hl-item.has-details { cursor: pointer; transition: background .15s ease; }
.hl-item.has-details:hover { background: rgba(255,255,255,.08); }

/* Hover tooltip — fixed overlay, unaffected by the canvas scale */
.hover-tip {
  position: fixed; z-index: 50;
  width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-top: 3px solid var(--accent);
  box-shadow: 0 10px 28px rgba(0,5,32,.16);
  padding: 12px 14px;
  pointer-events: none;
}
.hover-tip[hidden] { display: none; }
.hover-tip { max-height: calc(100vh - 24px); overflow: hidden; }
.tip-title { font-size: 13.5px; font-weight: 800; color: var(--ink-900); margin-bottom: 4px; }
/* Short plain-language explanation of what the metric means — always
   shown on hover, before any top-5 entries. */
.tip-desc {
  font-size: 11.5px; font-weight: 600; color: var(--ink-500);
  line-height: 1.45; margin-bottom: 8px;
}
.tip-desc:empty { display: none; }
.tip-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-600);
  padding: 3px 0 1px;
}
/* Top-5 mini bar chart — one proportional bar per entry, coloured by
   severity/category, width relative to the largest value in the
   (group's) visible set. */
.tip-bar-track {
  height: 5px; background: var(--canvas-bg);
  overflow: hidden; margin: 0 0 4px;
}
.tip-bar-fill { height: 100%; background: var(--blue-mid); }
/* Category/section header inside a grouped tooltip (e.g. the
   CREATE / WRITE / DELETE groups on Privileged Activities). */
.tip-group {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 9px; padding-top: 7px;
  border-top: 1px solid var(--card-border);
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ink-300);
}
.tip-group:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.tip-group .tip-group-val { font-weight: 900; color: var(--ink-900); }
.tip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-val { font-weight: 900; color: var(--ink-900); flex: 0 0 auto; }
.tip-extra {
  font-size: 11px; font-weight: 600; color: var(--ink-400);
  padding: 0 0 4px; margin-top: -2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tip-foot {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--card-border);
  font-size: 11px; font-weight: 700; color: var(--ink-300);
  text-transform: uppercase; letter-spacing: .4px;
}

/* Right detail panel — slides in over the canvas at native scale */
.detail-panel {
  position: fixed; top: 0; right: 0; z-index: 60;
  width: min(400px, 100vw); height: 100vh;
  background: var(--card-bg);
  border-left: 3px solid var(--accent);
  box-shadow: -14px 0 40px rgba(0,5,32,.28);
  transform: translateX(105%);
  transition: transform .28s ease;
  display: flex; flex-direction: column;
}
.detail-panel.open { transform: translateX(0); }
.panel-head {
  background: var(--navy-900);
  padding: 18px 20px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.panel-title { font-size: 16px; font-weight: 800; color: #fff; }
.panel-count { font-size: 12px; font-weight: 700; color: var(--navy-200); margin-top: 3px; }
.panel-head-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.panel-close, .panel-info {
  background: none; border: none; cursor: pointer;
  color: var(--navy-200); font-size: 15px; font-weight: 800;
  padding: 2px 6px; line-height: 1;
}
.panel-close:hover, .panel-info:hover { color: #fff; background: var(--navy-700); }
.panel-info { font-size: 17px; }
.panel-info[aria-expanded="true"] { color: var(--accent); }
.panel-info[hidden] { display: none; }
.panel-source {
  padding: 10px 20px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-400);
  border-bottom: 1px solid var(--card-border);
  background: var(--canvas-bg);
}

/* KQL viewer — toggled by the ⓘ button, shows the exact query
   template(s) (from app/data/pawlyzer-queries.js) behind the metric. */
.panel-kql {
  max-height: 45vh; overflow-y: auto;
  padding: 12px 20px;
  border-bottom: 1px solid var(--card-border);
  background: var(--ink-900);
}
.panel-kql[hidden] { display: none; }
.kql-block + .kql-block { margin-top: 12px; }
.kql-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.kql-filename {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; font-weight: 700; color: var(--navy-200);
}
.kql-copy {
  background: var(--navy-700); border: none; cursor: pointer;
  color: var(--navy-100); font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 8px;
}
.kql-copy:hover:not(:disabled) { color: #fff; background: var(--navy-900); border: 1px solid var(--navy-200); }
.kql-copy:disabled { opacity: .4; cursor: default; }
.kql-code {
  margin: 0; max-height: 220px; overflow: auto;
  background: rgba(0,0,0,.28);
  padding: 10px 12px;
}
.kql-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; line-height: 1.55; color: #dfe6f0;
  white-space: pre;
}
.kql-note {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--navy-700);
  font-size: 11px; font-weight: 600; line-height: 1.4; color: var(--navy-100);
}
.panel-body { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }

/* One paginated page of related entities — a distinct, roomier format
   from the compact hover tooltip (.tip-row), since this is meant to be
   read as a list, not skimmed in a corner of the screen. */
.panel-entry { padding: 9px 8px; }
.panel-entry.zebra { background: var(--canvas-bg); }
/* Group header inside the panel list — mirrors .tip-group. */
.entry-group {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  display: flex; justify-content: space-between; gap: 12px;
  margin: 12px 8px 2px; padding-top: 8px;
  border-top: 1px solid var(--card-border);
  font-size: 11px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ink-300);
}
.entry-group:first-child { margin-top: 2px; padding-top: 0; border-top: none; }
.entry-group .entry-group-val { font-weight: 900; color: var(--ink-900); }
/* Proportional bar under a panel entry — same idea as .tip-bar-track. */
.entry-bar-track {
  height: 5px; background: var(--canvas-bg);
  overflow: hidden; margin: 4px 0 0 30px;
}
.panel-entry.zebra .entry-bar-track { background: #e2e5ea; }
.entry-bar-fill { height: 100%; background: var(--blue-mid); }
/* PII notice — entity labels are GUIDs because the collection ran
   without -IncludeDetails. */
.panel-pii-note {
  margin: 2px 8px 10px; padding: 8px 10px;
  background: var(--tint-amber);
  font-size: 11px; font-weight: 600; line-height: 1.45; color: #8a6a06;
}
.entry-main { display: flex; align-items: baseline; gap: 10px; }
.entry-index {
  flex: 0 0 auto; min-width: 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; font-weight: 700; color: var(--ink-300);
}
.entry-label {
  flex: 1 1 auto; font-size: 13px; font-weight: 700; color: var(--ink-700);
  overflow-wrap: anywhere;
}
.entry-val { flex: 0 0 auto; font-size: 13px; font-weight: 900; color: var(--ink-900); }
.entry-extra {
  margin: 3px 0 0 30px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-400);
  overflow-wrap: anywhere;
}

/* Pager — only shown once a list has more than one page (PANEL_PAGE_SIZE
   in app.js), so a short list never grows a footer it doesn't need. */
.panel-pager {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 20px;
  border-top: 1px solid var(--card-border);
  background: var(--canvas-bg);
}
.panel-pager[hidden] { display: none; }
.pager-btn {
  background: var(--card-bg); border: 1px solid var(--card-border); cursor: pointer;
  color: var(--ink-600); font-size: 11px; font-weight: 800;
  padding: 5px 10px; flex: 0 0 auto;
}
.pager-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--ink-900); }
.pager-btn:disabled { opacity: .35; cursor: default; }
.pager-status {
  font-size: 11px; font-weight: 700; color: var(--ink-400);
  text-align: center; flex: 1 1 auto;
}

.panel-hint { font-size: 13px; font-weight: 600; color: var(--ink-400); padding: 14px 12px; }
.panel-hint-title { color: var(--ink-600); line-height: 1.5; margin-bottom: 12px; }

/* Reference block in a card's empty state — the exact commands to
   re-collect with -IncludeDetails, styled like the ⓘ KQL viewer so the
   two "here's the exact thing to run/read" affordances feel related. */
.cmd-block {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  background: var(--ink-900); padding: 10px 12px;
}
.cmd-code {
  margin: 0; flex: 1 1 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; line-height: 1.6; color: #dfe6f0; white-space: pre;
}
.cmd-copy { flex: 0 0 auto; }
.panel-hint-note { font-size: 11.5px; font-weight: 500; line-height: 1.5; margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  .detail-panel { transition: none; }
  .has-details { transition: none; }
}
