/* The redrawn Inbox: the header's switch and button, and the To Grade stacks
   (slice I1 of docs/plans/inbox-redesign-plan.md; boards R1, R2 and R4).
   Behind the build switch inboxStacks: the tile has .is-stacks only with it on.
   Sizes follow the board; colours are the app's tokens. DashInboxStacks sets
   --dash-inbox-sh (a stack's height) and --dash-inbox-ph (an opened page's)
   from the room the tile leaves. */

/* ── The header ────────────────────────────────────────── */
.dash-inbox.is-stacks .dash-inbox-head {
  flex-wrap: nowrap;
  gap: 12px;
}
.dash-inbox.is-stacks .dash-inbox-title {
  font-size: var(--text-xl);
  font-weight: 700;
}
.dash-inbox-switch .seg-btn {
  min-height: 32px;
  padding-block: 0;
  line-height: 28px;
  font-weight: 600;
}
.dash-inbox-action {
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 32px;
  font-weight: 600;
}
/* The Dashboard has no solid blue action (e2e/primary-actions.spec.js):
   Start Grading is an outline button, as Class Settings is. */
.dash-inbox-action.is-start {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.dash-inbox-action.is-start:hover {
  background: var(--overlay-hover);
}
.dash-inbox-action.is-return {
  color: #fff;
  background: var(--score-3);
  border: 0;
}
.dash-inbox-action.is-return:hover {
  filter: brightness(0.92);
}

/* ── The stacks ────────────────────────────────────────── */
.dash-inbox-stacks {
  --dash-inbox-sh: 150px;
  --dash-inbox-ph: 120px;
  --dash-gap: 24px;
  --dash-w: 120px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.dash-inbox-stacks-row {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  /* Room above and to the right for the count on a stack's corner. */
  padding: 12px 16px 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
}
/* Closed, the cards are laid out across the whole row (DashRowSize writes
   --dash-w, --dash-gap and --dash-inbox-sh from DashRowFit's plan): as many
   columns as the width has room for, the cards sharing the spare width so the
   row runs edge to edge, wrapping into more rows that scroll down the tile.
   Beside Bulletins the tile is as tall as its one row of stacks (the left
   column's rows are set inline). A band of 24 px above the cards holds the
   count on a card's corner; the row's own padding holds what hangs past its
   right edge. */
.dash-inbox-stacks:not(.has-open) .dash-inbox-stacks-row {
  gap: var(--dash-gap);
  margin: 0 -12px;
  padding: 0;
  overflow: hidden;
}
/* More stacks than the rows show: the head links "+ N More" to To Grade on
   Assignments (dash-row-size.js). The cards never scroll inside the tile and
   are never faded: a fade lay over the titles' second line, and a hidden
   scroll caught the wheel meant for the page (Colin, Nov 28, "that's a
   downgrade"). Only whole rows show. */
.dash-inbox-more {
  flex: 0 0 auto;
  font-size: var(--text-sm);
  line-height: 20px;
  font-weight: 600;
  color: var(--link);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
/* Beside the view switch, not pushed out to the middle by the head's own link rule. */
.page-dashboard .dash-section-title a.dash-inbox-more {
  margin-left: 0;
}
.dash-inbox-more:hover {
  text-decoration: underline;
}
/* In a narrow head, "Assignments →" gives way before the count does. */
.dash-inbox-head > a.dash-inbox-all,
.dash-inbox-head > [data-href*='/assignments']:not(.dash-inbox-more) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-inbox-stacks:not(.has-open) .dash-inbox-stacks-cards {
  max-height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  padding: 24px 12px 0;
}
.dash-inbox-stacks-cards {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  gap: 24px var(--dash-gap);
}
/* Opened, the stacks are the row's own items again, as before. */
.dash-inbox-stacks.has-open .dash-inbox-stacks-cards {
  display: contents;
}
.dash-inbox-stack-group {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: var(--dash-w);
}
.dash-inbox-stack {
  position: relative;
  display: block;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 100%;
  height: var(--dash-inbox-sh);
  padding: 0;
  font: inherit;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}
.dash-inbox-stack:focus-visible,
.dash-inbox-spread-close:focus-visible,
.dash-inbox-notin-chip:focus-visible,
.dash-inbox-notin-link:focus-visible,
.dash-inbox-stack-title:focus-visible,
.dash-inbox-spread-title:focus-visible,
.dash-inbox-return-btn:focus-visible {
  outline: 2px solid var(--active);
  outline-offset: 2px;
}
.dash-inbox-stack-layer {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border: 1px solid var(--divider-heavy);
  border-radius: 4px;
  /* Each layer reaches 2 px further; the four of them stay inside the 8 px gap under the stack. */
  transform: translate(calc(var(--k) * 2px), calc(var(--k) * 2px));
}
.dash-inbox-stack-sheet {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--divider-heavy);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.dash-inbox-stack-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
/* A paper hand-in with no scan, and a sheet with nothing on it yet. */
.dash-inbox-stack-note {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}
.dash-inbox-stack-note span {
  font-weight: 500;
  color: var(--text-2);
}
.dash-inbox-stack-lines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 17px, var(--divider-heavy) 17px 18px);
}
.dash-inbox-stack-count,
.dash-inbox-return-count {
  position: absolute;
  top: -12px;
  right: -12px;
  box-sizing: border-box;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  line-height: 24px;
  font-weight: 700;
  color: #fff;
  background: var(--active-fill);
  border-radius: 999px;
  box-shadow: 0 0 0 2px var(--surface);
}
.dash-inbox-stack-late {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 0 8px;
  font-size: var(--text-xs);
  line-height: 22px;
  font-weight: 700;
  color: var(--score-2-text);
  background: color-mix(in srgb, var(--late) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--late) 55%, transparent);
  border-radius: 999px;
}
.dash-inbox-stack-cap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  height: 32px;
}
.dash-inbox-stack-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 4px;
  background: var(--active-fill);
  border-radius: 999px;
}
.dash-inbox-stack-title,
.dash-inbox-spread-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* A word wider than the card breaks with a hyphen, never cut mid-word ("Ontologica"). */
  overflow-wrap: break-word;
  hyphens: auto;
  min-width: 0;
  padding: 0;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 16px;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}
.dash-inbox-stack-title:hover,
.dash-inbox-spread-title:hover {
  text-decoration: underline;
}

/* ── A stack opened (R2): its pages, then Not In ───────── */
.dash-inbox-stacks.has-open .dash-inbox-stack {
  height: calc(var(--dash-inbox-sh) * 0.71);
  width: calc(var(--dash-inbox-sh) * 0.71 * 0.766);
}
.dash-inbox-stacks.has-open .dash-inbox-stack-group {
  width: auto;
  margin-top: 44px;
}
.dash-inbox-stacks.has-open .dash-inbox-stack-cap {
  width: max(calc(var(--dash-inbox-sh) * 0.71 * 0.766 + 6px), 96px);
}
.dash-inbox-stacks.has-open .dash-inbox-stack-title {
  font-size: var(--text-sm);
}
.dash-inbox-spread {
  /* Holds the menu a Not In name opens (dash-inbox-rollcall.js, menuOn). */
  position: relative;
  flex: 0 0 auto;
  /* Never wider than the row: what does not fit beside it scrolls. */
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 16px;
  background: var(--bg);
  border-radius: var(--radius);
}
.dash-inbox-spread-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-inbox-spread-title {
  flex: 1 1 auto;
  line-height: 20px;
  font-size: var(--text-md);
  font-weight: 700;
  -webkit-line-clamp: 1;
}
.dash-inbox-spread-close {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text);
  background: var(--surface-2);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.dash-inbox-spread-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}
.dash-inbox-pages {
  display: flex;
  flex: 0 1 auto;
  gap: 14px;
  min-width: calc(var(--dash-inbox-ph) * 0.767 + 4px);
  margin: 0;
  /* Room for a focus ring on a page at either end. */
  padding: 3px 3px 4px;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
}
.dash-inbox-pages > li {
  flex: 0 0 auto;
}
.dash-inbox-page:focus-visible {
  outline: none;
}
.dash-inbox-page:focus-visible .dash-inbox-page-sheet {
  outline: 2px solid var(--active);
  outline-offset: 1px;
}
.dash-inbox-page {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}
.dash-inbox-page-sheet {
  position: relative;
  display: block;
  box-sizing: border-box;
  overflow: hidden;
  width: calc(var(--dash-inbox-ph) * 0.767);
  height: var(--dash-inbox-ph);
  background: var(--surface);
  border: 1px solid var(--divider-heavy);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.dash-inbox-page-count {
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 1px 7px;
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--divider-heavy);
  border-radius: 999px;
}
.dash-inbox-page-name {
  max-width: max(calc(var(--dash-inbox-ph) * 0.767), 128px);
  overflow: hidden;
  font-size: var(--text-base);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-inbox-page-when {
  max-width: max(calc(var(--dash-inbox-ph) * 0.767), 128px);
  overflow: hidden;
  font-size: var(--text-sm);
  color: var(--text-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-inbox-notin {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 214px;
  max-height: calc(var(--dash-inbox-ph) + 50px);
  margin-left: 6px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 1px solid var(--divider-strong);
  overflow-y: auto;
}
.dash-inbox-notin-head {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 700;
}
.dash-inbox-notin-link {
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}
.dash-inbox-notin-link:hover {
  text-decoration: underline;
}
.dash-inbox-notin-n {
  font-weight: 600;
  color: var(--text-2);
}
.dash-inbox-notin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dash-inbox-notin-chip {
  box-sizing: border-box;
  min-height: 30px;
  padding: 4px 10px;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  background: var(--surface);
  border: 1.5px dashed var(--text-3);
  border-radius: 999px;
  cursor: pointer;
}
.dash-inbox-notin-chip:hover,
.dash-inbox-notin-chip.is-open {
  background: var(--divider-subtle);
}

/* ── Graded piles to return (R1, R4) ───────────────────── */
/* Closed, a pile to return is a card like a stack, in the same columns: face
   down, its count, its title and Return N under it. */
.dash-inbox-returns {
  display: contents;
}
.dash-inbox-return {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: var(--dash-w);
}
.dash-inbox-return-back {
  position: relative;
  box-sizing: border-box;
  height: var(--dash-inbox-sh);
}
.dash-inbox-return-back .dash-inbox-stack-layer {
  background: var(--ok-bg);
  border-color: color-mix(in srgb, var(--score-3) 35%, transparent);
}
.dash-inbox-return-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--score-3);
  background: var(--ok-bg);
  border: 1px solid color-mix(in srgb, var(--score-3) 35%, transparent);
  border-radius: 4px;
}
.dash-inbox-return-face svg {
  width: 44px;
  height: 44px;
}
.dash-inbox-return-count {
  background: var(--score-3);
}
.dash-inbox-return .dash-inbox-stack-title {
  height: 32px;
}
.dash-inbox-return-btn {
  align-self: flex-start;
  box-sizing: border-box;
  min-height: 32px;
  padding: 0 12px;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  color: var(--score-3-dark);
  background: var(--surface);
  border: 1px solid var(--score-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.dash-inbox-return-btn.is-solid {
  color: #fff;
  background: var(--score-3);
}
.dash-inbox-return-btn:hover {
  filter: brightness(0.94);
}
/* With a stack opened, the piles sit at the right in a green box, as before. */
.dash-inbox-stacks.has-open .dash-inbox-returns {
  display: flex;
  flex: 0 0 auto;
  margin-left: auto;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 16px;
  background: var(--ok-bg);
  border-radius: var(--radius);
}
.dash-inbox-stacks.has-open .dash-inbox-return {
  width: calc(var(--dash-inbox-sh) * 0.62);
}
.dash-inbox-stacks.has-open .dash-inbox-return-back {
  height: calc(var(--dash-inbox-sh) * 0.8);
  margin: 0 8px 8px 0;
}

/* ── Coming Up (board "Dashboard Row, Revised After Review") ──────────────
   The class's next assignments in the columns the stacks leave empty: pale
   solid cards, never dashed (dashed means a place to drop files), behind a
   thin line with its label above. A card is a stack's size; DashRowSize
   shows as many as the row has columns left. */
.dash-coming {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: var(--dash-gap);
  margin-top: -24px;
  padding: 24px 0 0 var(--dash-gap);
  border-left: 1px solid var(--divider-medium);
}
.dash-coming[hidden],
.dash-coming-card[hidden] {
  display: none;
}
.dash-coming-label {
  position: absolute;
  top: 0;
  left: var(--dash-gap);
  font-size: var(--text-xs);
  line-height: 16px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.dash-coming-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: var(--dash-w);
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.dash-coming-card:focus-visible {
  outline: 2px solid var(--active);
  outline-offset: 2px;
}
.dash-coming-face {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--dash-inbox-sh);
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--surface-2);
  border-radius: 4px;
}
.dash-coming-card:hover .dash-coming-face {
  background: var(--bg-secondary);
}
.dash-coming-face b {
  font-size: var(--text-md);
  line-height: 20px;
  font-weight: 700;
  white-space: nowrap;
}
.dash-coming-bar {
  width: 64px;
  height: 4px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 2px;
}
.dash-coming-bar > span {
  display: block;
  height: 4px;
  background: var(--text-2);
}
.dash-coming-cap {
  display: flex;
  flex-direction: column;
  height: 32px;
  min-width: 0;
  font-size: var(--text-sm);
  line-height: 16px;
}
.dash-coming-cap b,
.dash-coming-cap span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-coming-cap b {
  font-weight: 600;
}
.dash-coming-cap span {
  color: var(--text-2);
}
.dash-inbox-stacks.has-open .dash-coming {
  display: none;
}
