/* =========================================================
   v6 — finding-header restructure + standalone segment bar.
   Loaded AFTER v5/apparel-insights.css to override header layout.
   Rules:
     · chart-type kicker hidden (removed in JSX)
     · title = description / dynamic title (minus segment)
     · segment + filtration shown as a distinct bar UNDER the title
     · right-side header metadata = sample size only
   ========================================================= */

/* Title now leads the header; keep n pinned right. */
.ap-find__head { align-items: center; gap: 10px 12px; margin-bottom: 10px; }
.ap-find__title { font-size: 14px; }

/* No divider between the argument claim and its findings. */
.ap-argcard__head { border-bottom: none; padding-bottom: 4px; }
/* Argument head is a flex row (claim + hover actions) — see the claim-actions
   block further down. */

/* More breathing room between argument cards. */
.ap-body { gap: 32px; }

/* Wider layout — roomier left nav + wider reading column so argument cards
   aren't cramped. Scoped to the apparel view. */
.ap-ins.gl-insx2 { grid-template-columns: 320px minmax(0, 1fr); }
.ap-ins .gl-bx-sticky__inner,
.ap-ins .gl-bx-sec__body { max-width: 1080px; }
/* More gutter between the card cluster and the paper edge (esp. before the
   column reaches its max width). */
.ap-ins .gl-bx-sticky__inner { padding-left: 80px; padding-right: 80px; }
.ap-ins .gl-bx-sec__body { padding-left: 80px; padding-right: 80px; }

/* Selected objective in the left index uses the same light-gray fill as its
   child argument items (not the green tint). */
.ap-ins .gl-bx-grp__head.is-active { background: var(--ms-platinum); }

/* =========================================================
   Objective section header — clear 3-level hierarchy:
     1. Objective title  (prominent)
     2. "Key takeaways"   (subheading, argument-claim style)
     3. takeaway items    (regular body text)
   ========================================================= */
.ap-objhead { margin-bottom: 20px; }
.ap-objhead__num {
  display: block;
  font-family: var(--ms-font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ms-dusty-green); margin-bottom: 9px;
}
.ap-objtitle {
  margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700;
  letter-spacing: -0.022em; color: var(--ms-fg); text-wrap: pretty;
}

/* Key takeaways sit in a tinted card — the primary claim under the objective,
   and the only tinted surface in the reading column. */
.ap-takeaways { background: var(--ms-white); border: 1px solid var(--ms-dusty-green); border-radius: 14px; padding: 24px 30px 26px; }
.ap-takeaways__head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.ap-takeaways__head .ap-claimacts { margin-left: auto; }
/* The takeaways cluster now sits at the right edge — open both surfaces leftward. */
.ap-takeaways__head .ap-conftip { left: auto; right: 0; }
.ap-takeaways__label {
  display: flex; align-items: center; gap: 9px;
  font-size: 18px; font-weight: 700; letter-spacing: -0.012em;
  color: var(--ms-dusty-green); margin-bottom: 0;
}
.ap-takeaways__label .ti { font-size: 18px; line-height: 1; }

/* =========================================================
   Claim-level hover affordances — confidence badge + report.
   Revealed on hover of the claim they belong to. The report action stays
   chrome-free (no background, no border, color shift only); the confidence
   badge is a quiet tinted pill in three tiers.
   ========================================================= */
.ap-claimacts {
  position: relative;
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  opacity: 0; transition: opacity 0.14s ease;
}
.ap-takeaways:hover .ap-claimacts,
.ap-argcard:hover .ap-claimacts,
.ap-claimacts.is-open,
.ap-claimacts:focus-within { opacity: 1; }
.ap-claimact {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; margin: 0;
  border: none; background: none; box-shadow: none; border-radius: var(--corner-8, 8px);
  color: var(--ms-fg); cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}
.ap-claimact:hover, .ap-claimact:focus-visible, .ap-claimact.is-on { color: var(--ms-fg); background: var(--ms-platinum); outline: none; }
.ap-claimact .ti { font-size: 17px; line-height: 1; }

/* Confidence badge — three tiers: high (green) · moderate (light green) · low (yellow). */
.ap-confwrap { position: relative; display: inline-flex; }
.ap-confbadge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 10px; box-sizing: border-box;
  border: none; border-radius: 999px; cursor: pointer;
  font-family: var(--ms-font-mono); font-size: 11px; font-weight: 400;
  letter-spacing: 0.02em; text-transform: none; white-space: nowrap;
  transition: filter 0.12s ease;
}
.ap-confbadge:hover { filter: brightness(0.97); }
.ap-confbadge--high { background: var(--ms-dusty-green); color: #fff; }
.ap-confbadge--mid  { background: var(--ms-platinum); box-shadow: inset 0 0 0 1px var(--ms-dusty-green); color: var(--ms-fg); }
.ap-confbadge--low  { background: var(--ms-platinum); box-shadow: inset 0 0 0 1px var(--ms-clay); color: var(--ms-fg); }

/* Icon-only confidence mode: same chrome-free treatment as the report icon. */
.ap-claimact--conf .ti { font-size: 18px; }

/* ---- Confidence tooltip (why this tier) ---- */
.ap-conftip {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 45;
  width: 336px; padding: 13px 14px 12px; box-sizing: border-box;
  background: var(--ms-onyx, #0e1721); color: #fff;
  border-radius: 10px; box-shadow: 0 18px 40px -14px rgba(4,12,21,0.55);
  text-align: left; text-transform: none; letter-spacing: 0;
  opacity: 0; pointer-events: none; transform: translateY(-3px);
  transition: opacity 0.13s ease, transform 0.13s ease;
}
.ap-confwrap:hover .ap-conftip, .ap-confbadge:focus-visible + .ap-conftip { opacity: 1; transform: none; }
/* On argument cards the cluster is pinned right — open leftward so the tooltip
   stays inside the scrolling reading panel. */
.ap-argcard .ap-conftip { left: auto; right: 0; }
.ap-conftip__hd, .ap-conftip__sighint { display: none; }
.ap-conftip__tier { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.ap-conftip__tier--high { background: var(--ms-green-2); }
.ap-conftip__tier--mid { background: var(--ms-green-3); }
.ap-conftip__tier--low { background: var(--ms-clay-light); }
.ap-conftip__sig + .ap-conftip__sig { margin-top: 13px; }
.ap-conftip__sigtop { display: flex; align-items: baseline; gap: 8px; }
.ap-conftip__signame { font-size: 12px; font-weight: 700; color: #fff; }
.ap-conftip__sigval { margin-left: auto; font-family: var(--ms-font-mono); font-size: 12px; font-weight: 700; color: #fff; }
.ap-conftip__sigval i { font-style: normal; font-weight: 400; opacity: 0.5; font-size: 10.5px; }
.ap-conftip__meter {
  height: 3px; border-radius: 3px; margin: 6px 0 6px;
  background: rgba(255,255,255,0.18); overflow: hidden;
}
.ap-conftip__meter > span { display: block; height: 100%; }
.ap-conftip__meter > span.is-good { background: var(--ms-green-2); }
.ap-conftip__meter > span.is-warn { background: var(--ms-clay-light); }
.ap-conftip__sigsay { font-size: 12px; line-height: 1.45; color: rgba(255,255,255,0.72); text-wrap: pretty; }
.ap-conftip__why {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.14);
  font-size: 11.5px; line-height: 1.5; color: rgba(255,255,255,0.62); text-wrap: pretty;
}

/* Significance verdict chips ("No difference", "Strong effect", …) hidden in
   the findings — the claim carries the read, the chip added noise. */
.ap-ins .ap-vchip { display: none; }

.ap-argcard__head { display: flex; align-items: flex-start; gap: 10px; }
/* Let the report popover and confidence tooltip escape the card's clipped box. */
.ap-argcard:has(.ap-claimacts.is-open), .ap-argcard:has(.ap-confwrap:hover) { overflow: visible; }

/* ---- Report popover: thumbs + reason + submit ---- */
@keyframes apFbPopIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ap-fbpop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: 392px; padding: 16px; box-sizing: border-box;
  background: var(--ms-white); border: 1px solid var(--ms-border);
  border-radius: 12px; box-shadow: 0 18px 44px -14px rgba(4,12,21,0.3);
  text-align: left; animation: apFbPopIn 0.13s ease;
}
/* The takeaways cluster sits at the right edge — keep the popover right-aligned. */
.ap-takeaways__head .ap-fbpop { right: 0; left: auto; }
.ap-fbpop__lab { font-size: 15px; font-weight: 700; line-height: 1.3; }
.ap-fbpop__head { display: flex; align-items: center; gap: 12px; }
.ap-fbpop__lab {
  flex: 1; min-width: 0;
  letter-spacing: -0.012em; text-transform: none;
  color: var(--ms-fg); margin-bottom: 0;
}
.ap-fbpop__rate { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-shrink: 0; }
.ap-fbpop__thumb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; box-sizing: border-box;
  border: none; border-radius: var(--corner-8, 8px);
  background: none;
  cursor: pointer; transition: background 0.12s ease, color 0.12s ease;
}
.ap-fbpop__thumb .ti { font-size: 18px; line-height: 1; }
.ap-fbpop__thumb--up { color: var(--ms-dusty-green); }
.ap-fbpop__thumb--up:hover, .ap-fbpop__thumb--up.is-on { background: var(--ms-green-5); }
.ap-fbpop__thumb--down { color: var(--base-red-main); }
.ap-fbpop__thumb--down:hover, .ap-fbpop__thumb--down.is-on { background: var(--base-red-1); }
.ap-fbpop__note {
  display: block; width: 100%; box-sizing: border-box; margin-top: 10px;
  min-height: 72px; resize: vertical; padding: 9px 10px;
  border: 1px solid var(--ms-border); border-radius: 8px;
  background: var(--ms-white); color: var(--ms-fg);
  font-family: inherit; font-size: 12.5px; line-height: 1.45;
}
.ap-fbpop__note::placeholder { color: var(--ms-fg-subtle); }
.ap-fbpop__note:focus { outline: none; border-color: var(--ms-fg-subtle); }
.ap-fbpop__foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.ap-fbpop__cancel {
  height: 30px; padding: 0 10px; border: none; background: none;
  color: var(--ms-fg-muted); font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; border-radius: 8px;
}
.ap-fbpop__cancel:hover { color: var(--ms-fg); }
.ap-fbpop__submit {
  height: 30px; padding: 0 14px; border: none; border-radius: 8px;
  background: var(--ms-dusty-green); color: #fff;
  font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: filter 0.12s ease;
}
.ap-fbpop__submit:hover { filter: brightness(1.06); }
.ap-fbpop__submit:disabled { background: var(--ms-ink-7, #e6ebef); color: var(--ms-fg-subtle); cursor: default; filter: none; }
.ap-fbpop__done { display: flex; align-items: flex-start; gap: 10px; padding: 2px 0; }
.ap-fbpop__done-ic { font-size: 20px; line-height: 1; color: var(--ms-dusty-green); flex-shrink: 0; }
.ap-fbpop__done-t { font-size: 13.5px; font-weight: 700; color: var(--ms-fg); }
.ap-fbpop__done-s { font-size: 12.5px; line-height: 1.45; color: var(--ms-fg-muted); margin-top: 2px; }
.ap-argcard__head .ap-argcard__claim { flex: 1; min-width: 0; }
.ap-argcard__head .ap-claimacts { margin-top: 1px; }
/* Takeaway items — regular body text. */
.ap-takeaways__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.ap-takeaways__list li {
  position: relative; padding-left: 22px;
  font-size: 15px; line-height: 1.5; font-weight: 400; color: var(--ms-fg);
  letter-spacing: -0.01em; text-wrap: pretty;
}
.ap-takeaways__list li::before {
  content: ""; position: absolute; left: 2px; top: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ms-dusty-green);
}

/* Polarity / short descriptor that rides with the title (advdet + heatmap). */
.ap-find__desc {
  font-family: var(--ms-font-mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--ms-fg-subtle);
}
.ap-find__head--prod .ap-find__desc { text-transform: none; letter-spacing: 0.02em; font-size: 11px; }
.ap-find__desc--pos { color: #2f6b16; }
.ap-find__desc--neg { color: var(--ms-clay-deep); }

/* ---- Segment / filtration bar ---- */
.ap-seg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 15px; }
.ap-seg__trace { margin-left: auto; flex-shrink: 0; }
.ap-trace-inline .ap-seg__trace { margin-left: 0; }

/* Explore-the-data trace banner: back-to-finding button. */
.rr-trace__back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid var(--ms-green-3); background: var(--ms-white);
  color: var(--ms-dusty-green); flex-shrink: 0; cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.rr-trace__back:hover { background: var(--ms-green-5); border-color: var(--ms-dusty-green); }

/* Flash the finding the user is sent back to. */
@keyframes apFindFlash { 0%,100% { box-shadow: 0 0 0 0 transparent; } 15%,60% { box-shadow: 0 0 0 3px var(--ms-green-3); } }
.ap-findblock--flash { animation: apFindFlash 1.5s ease; border-radius: 8px; }
.rr-pq--flash { animation: apFindFlash 1.5s ease; border-radius: 12px; }

/* Keep the trace banner in view so "back to finding" is always reachable. */
.rr__center .rr-trace { position: sticky; top: 8px; z-index: 5; box-shadow: 0 4px 16px -6px rgba(0,0,0,0.18); }
.ap-trace.gl-rf-trace { margin-left: 0; color: var(--ms-fg); border: 1px solid transparent; border-radius: 999px; }
.ap-trace.gl-rf-trace:hover { background: var(--ms-platinum); border-color: transparent; color: var(--ms-fg); }

/* Sample-size badge — MakerSights design-system badge (outlined · secondary ·
   squared), sits at the left of the segment bar. */
.bdg.ap-nbadge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px;
  padding: 0 12px; box-sizing: border-box;
  border: none; border-radius: 999px;
  background: var(--ms-platinum);
  font-family: var(--ms-font-mono); font-size: 11.5px; line-height: 1;
  letter-spacing: 0.02em; flex-shrink: 0;
}
.ap-nbadge__k { color: var(--ms-fg); font-weight: 400; }
.ap-nbadge__ic { font-size: 14px; color: var(--ms-fg); flex-shrink: 0; }
.ap-nbadge__v { color: var(--ms-fg); font-weight: 400; }

.ap-seg__chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 12px 4px 11px; border-radius: 999px;
  border: 1px solid transparent; background: var(--ms-platinum);
  line-height: 1.15; max-width: 100%;
}
.ap-seg__ic { font-size: 14px; color: var(--ms-fg-subtle); flex-shrink: 0; }
.ap-seg__dim {
  font-family: var(--ms-font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ms-fg-subtle);
  flex-shrink: 0;
}
.ap-seg__sep { flex-shrink: 0; width: 3px; height: 3px; border-radius: 50%; align-self: center; margin: 0 1px; background: var(--ms-fg-subtle); opacity: 0.8; }
.ap-seg__val {
  font-size: 12px; font-weight: 700; color: var(--ms-fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Demographic / answer-option cut — filter-like affordance. */
.ap-seg__chip--seg { cursor: default; transition: border-color 0.12s ease, background 0.12s ease; }
.ap-seg__chip--seg:hover { border-color: var(--ms-fg-subtle); background: var(--ms-white, #fff); }

/* All-respondents (no cut). */
.ap-seg__chip--all { border: none; border-radius: 999px; background: var(--ms-platinum); }
.ap-seg__chip--all .ap-seg__ic { color: var(--ms-fg); }
.ap-seg__chip--all .ap-seg__val { font-weight: 400; color: var(--ms-fg); }

/* Behavioral cut (advocators / detractors) — colored by polarity. */
.ap-seg__chip--role .ap-seg__dim { font-size: 9.5px; }
.ap-seg__chip--role.ap-seg__chip--pos { background: var(--ms-green-5); border-color: var(--ms-green-3); }
.ap-seg__chip--role.ap-seg__chip--pos .ap-seg__dim { color: #2f6b16; }
.ap-seg__chip--role.ap-seg__chip--neg { background: var(--ms-sand); border-color: var(--ms-clay-light); }
.ap-seg__chip--role.ap-seg__chip--neg .ap-seg__dim { color: var(--ms-clay-deep); }

/* =========================================================
   Progressive disclosure — one hero "key finding" per argument
   card, with supporting findings collapsed behind a toggle.
   ========================================================= */

/* Eyebrow on the hero finding, tinted with the objective accent. */
.ap-findlabel__hero {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ms-font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ap-accent, var(--ms-dusty-green));
}
.ap-findlabel__hero::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ap-accent, var(--ms-dusty-green));
}

/* Supporting-findings group, revealed on expand. */
.ap-argcard__supporting { margin: 6px -22px 0; padding: 0 22px; border-top: 1px solid var(--ms-border); }
.ap-argcard__supporting-label {
  display: none;
  padding-top: 14px;
  font-family: var(--ms-font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ms-fg-subtle);
}
.ap-argcard__supporting > .ap-findblock { border-top-style: solid; margin: 0 -22px; padding: 0 22px; }
.ap-argcard__supporting > .ap-findblock:first-child { border-top: none; padding-top: 2px; }

/* Bottom toggle bar. */
.ap-argcard__more {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px 22px; margin: 0;
  border: none; border-top: 1px solid var(--ms-border);
  background: var(--ms-white, #fff);
  font-family: var(--ms-font-mono); font-size: 12.5px; font-weight: 400;
  letter-spacing: 0.06em; text-transform: none;
  color: var(--ms-fg); cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.ap-argcard__more:hover { background: var(--ms-platinum); color: var(--ms-fg); }
.ap-argcard__more-ic { font-size: 15px; line-height: 1; }

/* Index: key-takeaways row under each objective. */
.ap-idxtk__ic { font-size: 14px; line-height: 1; color: var(--ms-dusty-green); flex-shrink: 0; width: 14px; text-align: center; margin-top: 1px; }
.ap-idxtk .gl-bx-item__txt { -webkit-line-clamp: 1; }

/* Index: findings group — expandable wrapper around the argument rows. */
.ap-idxfind { align-items: center; }
.ap-idxfind__ic { font-size: 14px; line-height: 1; color: var(--ms-fg-subtle); flex-shrink: 0; width: 14px; text-align: center; }
.ap-idxfind__n {
  flex-shrink: 0;
  font-family: var(--ms-font-mono); font-size: 10px; font-weight: 400;
  color: var(--ms-fg-muted); background: var(--ms-platinum);
  border-radius: 999px; padding: 2px 7px;
}
.ap-idxfind .gl-bx-item__txt { flex: 0 0 auto; }
.ap-idxfind--static { display: flex; align-items: center; cursor: default; background: none; }
.ap-idxfind--static:hover { background: none; }
.ap-idxargs { display: grid; }
.ap-idxargs .ap-idxarg { padding-left: 26px; }

/* Index panel reads in one ink — no gray secondary text. */
.ap-ins .gl-bx-index__scroll,
.ap-ins .gl-bx-index__scroll .gl-bx-grp__title,
.ap-ins .gl-bx-index__scroll .gl-bx-item__txt,
.ap-ins .gl-bx-index__scroll .ap-idxarg__n,
.ap-ins .gl-bx-index__scroll .ap-idxfind__ic,
.ap-ins .gl-bx-index__scroll .ap-idxfind__n,
.ap-ins .gl-bx-index__scroll .ap-idxtk__ic { color: var(--ms-fg); }

/* The takeaways / findings rows have no inline ask button — don't reserve room for it. */
.ap-idxfind:hover .gl-bx-item__txt, .ap-idxfind.is-sel .gl-bx-item__txt,
.ap-idxtk:hover .gl-bx-item__txt, .ap-idxtk.is-sel .gl-bx-item__txt { padding-right: 0; }

/* Divider between objective groups in the index. */
.ap-ins .gl-bx-index__scroll .gl-bx-grp { margin-bottom: 0; padding: 10px 0; }
.ap-ins .gl-bx-index__scroll .gl-bx-grp + .gl-bx-grp { border-top: 1px solid var(--ms-border); }
/* Rule spans the full panel width — cancel the scroll container's side padding. */
.ap-ins .gl-bx-index__scroll { padding-left: 0; padding-right: 0; }
.ap-ins .gl-bx-index__scroll .gl-bx-grp__head,
.ap-ins .gl-bx-index__scroll .gl-bx-item { margin-left: 12px; margin-right: 12px; width: calc(100% - 24px); }

/* Objective index number keeps the brand accent. */
.ap-ins .gl-bx-index__scroll .gl-bx-grp__num { color: var(--ms-dusty-green); }

