/* CaseNextComponent (app/components/case_next_component.rb), "Where this stands", and the case page's action bar with its overflow (CaseActionsComponent, "More"), the CARE and TAG UX fixes, track UA, and the
   TAG usability plan, T2 (docs/tag_usability/03-target-design.md). The block is a panel like every other on the case page: its head in small caps; the stage the case is at, in words, with how long it has been
   there as a badge whose word says it (Today, 2 days, Waiting 5 days, usually 3: never color alone); what the stage is, in a sentence; the stage's open items under their headings, each with who owes it and by
   when; and the one act that moves the case on, with the sentence that says what its sheet will ask. The accent edge on its inline start marks it as the place to start, never as an alarm; the words say everything.
   The checklist's own group headings (CasePlanComponent) sit in here too: a heading, and how many of its items are done.

   The action bar keeps the everyday actions in view and puts the rare ones that end a case behind "More", the browser's own disclosure (<details>), which works by keyboard and screen reader with
   no script. Its list opens below the button, in the flow (nothing floats over the page, so nothing is obscured: WCAG 2.4.11).

   Numbered 82 (the number is unique; it was 80 in the first round, which 80-home.css holds), after 68-case-page-layout.css, whose panel rules it extends. Tokens only and logical properties only,
   so it reads in light and in dark and mirrors in a right-to-left language. Everything that holds words wraps (WCAG 1.4.10). */

.case-show > .case-next,
.case-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  min-inline-size: 0;
  margin: 0;
  padding: 0 var(--case-pad, 0.75rem) 0.6rem;
  border: 1px solid var(--rule);
  border-inline-start: 3px solid var(--accent-line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}
.case-next > .person-page-heading {
  margin: 0 calc(-1 * var(--case-pad, 0.75rem));
  padding: 0.45rem var(--case-pad, 0.75rem);
  border-block-end: 1px solid var(--rule);
  background: var(--surface-sunken);
}
/* Where the case is: the stage's name large enough to be the thing the eye lands on, its age as a badge beside it, then the sentence that says what the stage is and a quiet line of when it began and how much of
   its list is done. */
.case-next__stand {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
}
.case-next__where,
.case-next__note,
.case-next__brief,
.case-next__meta,
.case-next__next,
.case-next__hint {
  margin: 0;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}
.case-next__where {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  font-weight: 600;
}
.case-next__stage {
  min-inline-size: 0;
  font-size: var(--text-md);
  font-weight: 700;
}
.case-next__where .pill {
  max-inline-size: 100%;
}
.case-next__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
  color: var(--fg2);
  font-size: var(--text-sm);
}
.case-next__note,
.case-next__next,
.case-next__hint {
  color: var(--fg2);
  font-size: var(--text-sm);
}

/* The stage's open items, under the office's headings: each heading with how many of its items are done, the list under it as dense rows (62-case-work.css). */
.case-next__todo {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
  margin-block-start: var(--space-2);
}
.case-next__todo > .case-work-subheading {
  margin: 0;
}
.case-next__group {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
}
.case-next__group-head,
.case-plan__piece-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-3);
  min-inline-size: 0;
}
.case-next__group-title,
.case-plan__heading {
  min-inline-size: 0;
  margin: 0;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 650;
  overflow-wrap: anywhere;
}
.case-next__group-count,
.case-plan__piece-count {
  min-inline-size: 0;
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
}
/* A checklist's groups are set apart from one another by the list's own gap; a group is its heading and its list. */
.case-plan__piece {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
}
.case-plan__group > :is(.case-plan__piece, .case-work-list) + :is(.case-plan__piece, .case-work-list) {
  margin-block-start: var(--space-3);
}
/* The link that ends an item is a target of its own (WCAG 2.5.8): 24 CSS px at the least, and the touch floor on a finger, as 62-case-work.css makes it for the plan and the reader's own list. */
.case-next__todo .case-work-meta > a {
  display: inline-flex;
  align-items: center;
  min-block-size: 1.5rem;
}
@media (pointer: coarse) {
  .case-next__todo .case-work-meta > a {
    min-block-size: var(--target-min);
  }
}

/* The warning about open items and what the move will ask, then the act: the buttons on a line, wrapping, each as wide as its words. */
.case-next__step {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
}
.case-next__text {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
}
.case-next__text:empty {
  display: none;
}
/* The warning is its badge and, beside it, its sentence; a long sentence wraps under its own first word and never under the badge. */
.case-next__warn {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
}
.case-next__note-text {
  flex: 1 1 12rem;
  min-inline-size: 0;
}
.case-next__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-inline-size: 0;
}
.case-next__actions:empty {
  display: none;
}
.case-next__actions .btn {
  max-inline-size: 100%;
  white-space: normal;
}
.case-next__owed {
  display: grid;
  gap: 0.25rem;
  min-inline-size: 0;
  margin-block-start: var(--space-2);
}
.case-next__owed > .case-work-subheading {
  margin: 0;
}

/* The action bar's overflow: "More" and the actions that end a case. */
.case-actions-more {
  position: relative;
}
.case-actions-more > summary {
  list-style: none;
  cursor: pointer;
}
.case-actions-more > summary::-webkit-details-marker {
  display: none;
}
.case-actions-more__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}

/* A status said after a write, moved next to the section it was about (case_return_controller.js). */
.case-show .case-work-status--moved {
  margin-block-end: 0.4rem;
}
/* Moved to a stage of the plan (a two-column grid: its mark, then its name and items), it takes the whole row above them. */
.case-show .case-checklist__step > .case-work-status--moved {
  grid-column: 1 / -1;
}

/* A section that waits behind its name (app/views/cases/_collapsed.html.erb): closed, it is one panel-head row with the browser's own marker; open, the section is drawn inside it as always,
   without a second frame. */
.case-show .case-collapsed {
  min-inline-size: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  overflow: clip;
}
.case-show .case-collapsed__summary {
  display: list-item;
  min-block-size: var(--target-min);
  padding: 0.6rem var(--case-pad, 0.75rem);
  background: var(--surface-sunken);
  color: var(--fg2);
  font-size: var(--case-label, 0.6875rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.case-show .case-collapsed__summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.case-show .case-collapsed__body > :is(section, nav, div) {
  border: 0;
  border-radius: 0;
}
/* Inside it, a section keeps a column section's inset and its head band (68-case-page-layout.css), so its sentence of help, which bleeds to the section's edge, stays inside the
   section at 320 CSS px rather than running past it. */
.case-show .case-collapsed__body > :is(section, nav) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  min-inline-size: 0;
  margin: 0;
  padding: 0 var(--case-pad) 0.6rem;
  overflow: clip;
}
.case-show .case-collapsed__body > :is(section, nav) > :is(.person-page-heading, .case-work-head) {
  margin: 0 calc(-1 * var(--case-pad));
  padding: 0.45rem var(--case-pad);
  border-block-end: 1px solid var(--rule);
  background: var(--surface-sunken);
}
