/* ==========================================================================
   Sample Dashboard v2 — Action Plan merge-round additions (.apx-).
   Extends views-core.css's .ap- action-plan compositions with the V1-merge
   thoroughness pass: fix.detail body copy, full next-up cards, the 4-week
   sequence, the before/after answer snippet, and the drafts accordion.
   Tokens/primitives come from base.css. Motion stays on transform/opacity.
   Cards stack at 880px max-width per the shell; refine further at 640px.
   ========================================================================== */

/* ---------- shared: fix.detail body copy on priority + next-up cards ---------- */
.apx-card__detail {
  margin: -2px 0 0;
  line-height: 1.6;
}

/* ---------- next up: full cards, 2-col grid ---------- */
.apx-next {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  align-items: stretch;
}
.apx-next-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- 4-week plan ---------- */
.apx-weeks {
  margin-top: 28px;
}
.apx-weeks__sub {
  margin: -8px 0 20px;
}
.apx-weeks__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.apx-week {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 0 22px;
  border-left: 1px solid var(--line);
}
.apx-week:first-child {
  padding-left: 0;
  border-left: 0;
}
.apx-week:last-child {
  padding-right: 0;
}
.apx-week__label {
  color: var(--accent-bright);
}
.apx-week__title {
  margin: 0;
  font-size: 0.90625rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.apx-week__list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 9px;
}
.apx-week__item {
  display: grid;
  grid-template-columns: 14px 1fr;
  align-items: start;
  gap: 8px;
  color: var(--muted);
  line-height: 1.5;
}
.apx-week__glyph {
  color: var(--accent);
  display: grid;
  place-items: center;
  padding-top: 2px;
}
.apx-week__glyph svg {
  width: 12px;
  height: 12px;
}

/* ---------- before / after answer snippet ---------- */
.apx-snippet {
  margin-top: 28px;
}
.apx-snippet__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 22px;
  margin-top: 6px;
}
.apx-snippet__arrow {
  color: var(--muted-2);
  display: grid;
  place-items: center;
}

.apx-snip {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  border-radius: var(--r-md);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  overflow: hidden;
}
.apx-snip--before {
  border-left-color: rgba(239, 126, 114, 0.45);
}
.apx-snip--after {
  border-left-color: rgba(106, 160, 255, 0.45);
}
.apx-snip__stamp {
  position: absolute;
  bottom: 14px;
  right: 14px;
  transform: rotate(-6deg);
  opacity: 0.55;
  padding: 3px 14px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.6;
  white-space: nowrap;
  pointer-events: none;
}
.apx-snip__head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.apx-snip__icon {
  border-radius: 4px;
  flex: none;
}
.apx-snip__engine {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  margin-right: auto;
}
.apx-snip__body {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--muted);
}
.apx-snip__body s {
  text-decoration-thickness: 1.5px;
}
.apx-snip__foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.apx-snip__citing {
  margin: 0;
}
.apx-snip__cites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- drafts accordion ---------- */
.apx-drafts {
  margin-top: 28px;
}
.apx-drafts__sub {
  margin: -8px 0 18px;
}
.apx-drafts__list {
  display: grid;
}
.apx-draft {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}
.apx-draft:first-child {
  border-top: 0;
  padding-top: 0;
}
.apx-draft:last-child {
  padding-bottom: 0;
}
.apx-draft__summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
  cursor: pointer;
  list-style: none;
  padding-right: 4px;
}
.apx-draft__summary::-webkit-details-marker {
  display: none;
}
.apx-draft__chevron {
  color: var(--accent-bright);
  display: grid;
  place-items: center;
  flex: none;
  transition: transform var(--dur-base) var(--ease-out);
}
.apx-draft[open] .apx-draft__chevron {
  transform: rotate(180deg);
}
.apx-draft__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  margin-right: auto;
}
.apx-draft__meta {
  flex: none;
}
.apx-draft__body {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding-left: 26px;
}
.apx-draft__item {
  display: grid;
  gap: 6px;
}
.apx-draft__label {
  margin: 0;
}
.apx-draft__copy {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  line-height: 1.6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .apx-weeks__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 0;
  }
  .apx-week {
    padding: 0 22px 20px;
    border-bottom: 1px solid var(--line);
  }
  .apx-week:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }
  .apx-week:nth-child(even) {
    padding-right: 0;
  }
  .apx-week:nth-last-child(-n+2) {
    border-bottom: 0;
    padding-bottom: 0;
  }
}

@media (max-width: 880px) {
  .apx-next {
    grid-template-columns: 1fr;
  }
  .apx-snippet__row {
    grid-template-columns: 1fr;
  }
  .apx-snippet__arrow {
    transform: rotate(90deg);
    margin: -4px 0;
  }
}

@media (max-width: 640px) {
  .apx-weeks__grid {
    grid-template-columns: 1fr;
  }
  .apx-week {
    border-left: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 18px;
  }
  .apx-week:first-child {
    padding-top: 0;
  }
  .apx-week:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }
  .apx-draft__body {
    padding-left: 0;
  }
}

/* Wide tables (retest board) scroll inside their wrapper instead of
   stretching the page — .table-wrap had no rule, so 375px viewports
   overflowed by the table's excess width. */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap > .table {
  min-width: 420px;
}
