/* analyse.css — additive styles owned by the "uianalyse" pass (epic #2426,
   round-3 review): connect.js, readiness.js, dimensions.js, discovery.js,
   roadmap.js, benchmark.js. Loaded AFTER app.css/lifecycle.css (see
   index.html) — every rule here either targets a class this pass introduced
   or narrows an existing selector with a MORE specific one; nothing here
   overrides app.css/lifecycle.css wholesale, per this pass's own brief
   ("if you need lifecycle.css changes, put them in analyse.css"). */

/* Dimensions — round-3 issue 27 ("Oversight scores 84 with 0/2 assessments"):
   a capped roll-up heatmap cell (a real, current open gap holding the score
   down) gets a small corner marker, visible scanning a whole grid — the
   cell's own `title` attribute still carries the full `cap_reason` text for
   anyone who hovers or uses a screen reader that exposes it. */
.mai-heatmap-cell.is-capped {
  position: relative;
}
.mai-heatmap-cell.is-capped::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mai-warn-ink);
}

/* B2 — the real Discovery submit form: one group of fields per area
   (Organisation & Industry, People & Culture, …), separated by a rule so a
   ~26-field dialog still reads as four short sections, not one long list. */
.mai-discovery-area {
  padding-top: var(--space-3);
  border-top: 1px solid var(--mai-line);
}
.mai-discovery-area:first-child {
  padding-top: 0;
  border-top: none;
}
.mai-discovery-area > h3 {
  margin: 0 0 var(--space-2);
}

/* Round-4 m12: Dimensions with nothing scored collapses to one card listing
 * the pending units, each a link. */
.mai-link-list { list-style: none; margin: 0; padding: var(--space-3) var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
/* Round-4 m9: roadmap cells wrap in full; the phase chip stays on one line. */
.mai-wrap { white-space: normal; overflow-wrap: anywhere; }
.mai-nowrap { white-space: nowrap; }
/* Round-4 B5: a group-admin ceilings cell carries its own Edit label. */
.mai-heatmap-edit { display: block; font-size: 12px; color: var(--mai-accent-text); line-height: 1; margin-top: 2px; }

/* Round-6 (#11/#29): over-limit banner, collapsed "Show all" groups, and the
 * per-row "More" menu on Connect data (opens downward, right-aligned). */
.mai-overcap-banner {
  padding: var(--space-3) var(--space-4); border-radius: var(--mai-radius);
  background: var(--mai-crit-soft); color: var(--mai-crit-ink); border: 1px solid var(--mai-crit);
  font-weight: 600;
}
.mai-disclosure { background: var(--mai-surface); border: 1px solid var(--mai-line); border-radius: var(--mai-radius); }
.mai-disclosure > summary { cursor: pointer; padding: var(--space-3) var(--space-4); font-weight: 600; font-size: var(--fs-sm); }
.mai-disclosure > summary:focus-visible { outline: none; box-shadow: var(--mai-focus); }
.mai-disclosure[open] > summary { border-bottom: 1px solid var(--mai-line); }
.mai-row-more { width: auto; display: inline-block; }
.mai-row-more > .mai-menu-list { top: calc(100% + 4px); bottom: auto; left: auto; right: 0; min-width: 160px; }
.mai-wrap { flex-wrap: wrap; }

/* Market ranking — one card per metric: a sentence and the peer spread on one line, better end on the right. */
.mai-peer-card { display: grid; gap: var(--space-2); padding: var(--space-3) 0; border-bottom: 1px solid var(--mai-line); }
.mai-peer-card:last-child { border-bottom: none; }
.mai-peer-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.mai-peer-head h3 { margin: 0; font-size: var(--fs-md, 1rem); }
.mai-peer-say { margin: 0; line-height: 1.5; max-width: 72ch; }
.mai-peer-strip { padding: 34px 8px 0; max-width: none; }
.mai-peer-track { position: relative; height: 8px; border-radius: 4px; background: var(--mai-surface-2, var(--mai-line)); }
.mai-peer-iqr { position: absolute; top: 0; bottom: 0; background: var(--mai-ink-2); opacity: 0.45; border-radius: 4px; }
.mai-peer-tick { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--mai-ink-2); transform: translateX(-1px); }
.mai-peer-tick-label { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: var(--fs-xs); color: var(--mai-ink-2); }
.mai-peer-us { position: absolute; top: -6px; width: 20px; height: 20px; border-radius: 50%; transform: translateX(-50%); background: var(--mai-accent); border: 2px solid var(--mai-surface); box-shadow: 0 0 0 1px var(--mai-ink-2); }
.mai-peer-us.is-crit { background: var(--mai-crit); }
.mai-peer-us.is-warn { background: var(--mai-warn); }
.mai-peer-us.is-good { background: var(--mai-good); }
.mai-peer-us-label { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: var(--fs-xs); font-weight: 600; color: var(--mai-ink); }
.mai-peer-ends { display: flex; justify-content: space-between; margin-top: 30px; }

/* Dimensions — "How this is measured": the framework's areas, their weights, scores and anchors. */
.mai-chips { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); }
.mai-subareas .mai-chip { cursor: default; padding: 1px 8px; }
.mai-subareas table.mai-table { width: 100%; }
.mai-subareas table.mai-table td { vertical-align: top; }
.mai-measured-list { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--mai-line); }
.mai-measured-list details.mai-subareas > summary { cursor: pointer; padding: var(--space-1) 0; }
.mai-subareas code { font-size: var(--fs-xs); }
