/* The Tasks tab's layouts (web/js/views/tasks-layouts.js): the layout pills, Compact's table and
   the Cards grid. List keeps its rows from styles.css. Everything here is built from Huddle's
   tokens, so Nova and Classic, light and dark, and every --font-scale follow the rest of the app. */

.tasks-layout-status {
  margin: -8px 0 16px;
  color: var(--danger);
  font-weight: 600;
}

.tasks-layout-status:empty {
  margin: 0;
}

.tasks-drag-hint {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
}

.tasks-layout-toolbar {
  justify-content: space-between;
}

.tasks-manage-areas {
  min-height: 44px;
}

.tasks-areas {
  flex: 1 0 100%;
  min-width: 0;
  padding: 16px;
}

.tasks-areas-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.tasks-areas-head h2 {
  margin: 0;
  font-size: 1.05em;
}

.tasks-areas-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .9em;
}

.tasks-area-list {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.tasks-area {
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.tasks-area-summary {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px;
  border: 0;
  background: transparent;
  color: var(--heading);
  cursor: pointer;
  text-align: left;
}

.tasks-area-summary span {
  flex: none;
  color: var(--muted);
  font-size: .85em;
}

.tasks-area-summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tasks-area-detail {
  display: grid;
  gap: 10px;
  padding: 0 0 12px;
}

.tasks-area-name {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: .8em;
  font-weight: 650;
  text-transform: uppercase;
}

.tasks-area-name .input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
}

.tasks-area-members {
  display: grid;
  gap: 6px;
}

.tasks-area-label {
  color: var(--muted);
  font-size: .8em;
  font-weight: 650;
  text-transform: uppercase;
}

.tasks-area-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.btn.tasks-area-chip {
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  gap: 5px;
  padding: 6px 10px;
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: .85em;
}

.btn.tasks-area-chip.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.tasks-area-remove {
  justify-self: start;
  max-width: 100%;
  min-height: 44px;
  overflow-wrap: anywhere;
  text-align: left;
}

.tasks-area-new {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.tasks-area-new .tasks-area-name {
  flex: 1 1 auto;
}

.tasks-area-new > .btn {
  min-height: 44px;
  flex: none;
}

.tasks-areas-status {
  margin: 10px 0 0;
  color: var(--ok);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tasks-areas .error {
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  /* The phone's bottom navigation and a running-PC bar cover the page's foot. A control the
     keyboard reaches keeps clear of them, as the Name hint and the panel's end do. */
  .tasks-areas :is(button, input),
  .tasks-manage-areas {
    scroll-margin-block: 8px calc(var(--phone-island-height, 0px) + var(--remote-bar-room, 0px) + 8px);
  }

  .tasks-layout-toolbar .segmented.tasks-layout-pills {
    flex: 1 0 100%;
  }

  .tasks-manage-areas {
    width: 100%;
  }

  .tasks-areas {
    padding: 12px;
  }

  .tasks-area-new {
    align-items: stretch;
    flex-direction: column;
  }

  .tasks-area-new > .btn {
    width: 100%;
  }
}

.tasks-title {
  color: var(--accent-ink);
  font-weight: 650;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.tasks-drag-grip {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 12px;
  color: var(--muted);
  cursor: grab;
  font-size: 14px;
  line-height: 1;
  user-select: none;
}

.tasks-drag-grip:active {
  cursor: grabbing;
}

@media (max-width: 860px), (pointer: coarse) {
  .tasks-drag-grip {
    display: none;
  }
}

.tasks-dragging {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

.tasks-list-row {
  position: relative;
}

.tasks-list-row > .tasks-drag-grip {
  position: absolute;
  top: 50%;
  left: 5px;
  transform: translateY(-50%);
  z-index: 1;
}

.tasks-card > .tasks-drag-grip {
  align-self: flex-start;
  margin: -2px 0 -2px -2px;
}

a.tasks-title:hover {
  text-decoration: underline;
}

.tasks-number {
  display: block;
  color: var(--muted);
  font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
}

.tasks-compact-inline-urgent {
  display: none;
}

.tasks-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.tasks-person .person-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-avatar);
  background: var(--person-colour);
  color: #ffffff;
  font-size: round(nearest, calc(11px * var(--font-scale)), 1px);
  font-weight: 700;
  --lh: 1;
}

.tasks-late {
  color: var(--danger);
  font-weight: 650;
}

/* A task's area (Compact's Area column, a card's foot). Long names wrap, inside a word if they
   must, rather than widen the column or the page. */
.badge.tasks-area-tag {
  max-width: 100%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  white-space: normal;
  overflow-wrap: anywhere;
}

.badge.tasks-area-tag.none {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

/* Compact: a table, its Task column taking the room the others leave. It needs about 66em of its
   card, more than there is beside the sidebar on narrow computers, so it stacks by the card's width
   (below). Anything still too wide scrolls inside the card rather than being cut off. */
.tasks-compact-card {
  container: tasks-compact / inline-size;
  overflow-x: auto;
}

.tasks-compact {
  width: 100%;
  border-collapse: collapse;
}

.tasks-compact th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: round(nearest, calc(12px * var(--font-scale)), 1px);
  font-weight: 650;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
}

.tasks-compact td {
  padding: 10px 12px;
  vertical-align: middle;
}

.tasks-compact tbody tr + tr td {
  border-top: 1px solid var(--line);
}

.tasks-compact th:first-child,
.tasks-compact td:first-child {
  padding-left: 22px;
}

.tasks-compact th:last-child,
.tasks-compact td:last-child {
  padding-right: 22px;
}

.tasks-compact-task {
  position: relative;
  min-width: 16em;
}

.tasks-compact-task > div {
  display: flex;
  gap: 10px;
}

.tasks-compact-task .grow {
  flex: 1;
  min-width: 0;
}

.tasks-compact-office,
.tasks-compact-status,
.tasks-compact-action {
  white-space: nowrap;
}

/* A width each, so a name or due date never gets squeezed to a letter a line; the Task column
   takes the rest. The Area column's width is a cap too: a long area name wraps inside it rather
   than taking room from the Task title or the person. */
.tasks-compact-person {
  width: 9.5em;
}

.tasks-compact-area {
  width: 8em;
  max-width: 8em;
}

.tasks-compact-due {
  width: 10.5em;
  font-size: round(nearest, calc(14px * var(--font-scale)), 1px);
}

.tasks-compact-due .badge {
  margin-top: 2px;
}

/* Phones, and cards too narrow for the table: two-line short row (Line 1: wrapping title link
   and Urgent badge; Line 2: person, due, status, office, area cut with an ellipsis, with Assign
   and Done at its right). */
@container tasks-compact (max-width: 60em) or (max-width: 860px) {
  .tasks-compact,
  .tasks-compact tbody,
  .tasks-compact tr {
    display: block;
  }
  .tasks-compact thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .tasks-compact tr {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, auto) auto minmax(0, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
  }
  .tasks-compact tr:has(.tasks-late) {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto minmax(0, 0.5fr) minmax(0, 0.5fr) auto;
  }
  .tasks-compact tbody tr + tr {
    border-top: 1px solid var(--line);
  }
  .tasks-compact tbody tr + tr td {
    border-top: 0;
  }
  .tasks-compact td,
  .tasks-compact td:first-child,
  .tasks-compact td:last-child {
    padding: 0;
  }
  .tasks-compact-task {
    grid-row: 1;
    grid-column: 1 / -1;
    min-width: 0;
  }
  .tasks-compact .tasks-number {
    display: inline;
    margin-left: 6px;
  }
  .tasks-compact-inline-urgent {
    display: inline-block;
    margin-left: 6px;
    vertical-align: baseline;
  }
  .tasks-compact-due > .badge.urgent {
    display: none;
  }
  .tasks-compact-person,
  .tasks-compact-due,
  .tasks-compact-office,
  .tasks-compact-area {
    grid-row: 2;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tasks-compact-status {
    grid-row: 2;
    grid-column: 3;
    white-space: nowrap;
  }
  .tasks-compact-status .badge {
    padding: 1px 7px;
  }
  .tasks-compact-person {
    grid-column: 1;
    width: auto;
    font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
  }
  .tasks-compact-person .tasks-person {
    display: inline-flex;
    max-width: 100%;
    gap: 5px;
    white-space: nowrap;
  }
  .tasks-compact-person .tasks-person > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tasks-compact-person .person-avatar {
    width: 20px;
    height: 20px;
    font-size: round(nearest, calc(10px * var(--font-scale)), 1px);
  }
  .tasks-compact-due {
    grid-column: 2;
    width: auto;
    font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
  }
  .tasks-compact-office {
    grid-column: 4;
    font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
  }
  .tasks-compact-area {
    grid-column: 5;
    width: auto;
    max-width: 100%;
  }
  .tasks-compact-area .badge.tasks-area-tag {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tasks-compact-action {
    grid-row: 2;
    grid-column: 6;
    justify-self: end;
  }
  .tasks-compact-action .btn {
    padding-inline: 8px;
  }
  .tasks-compact-action .tasks-assign-btn {
    display: inline-flex;
    margin: 0 4px 0 0;
  }
  .tasks-compact-action:empty {
    display: none;
  }
}

/* Beside the Hand to panel (css below) the card is about 236 px narrower, so there the columns
   and gaps are tighter, the office name and due date may wrap to two lines, and the table holds
   down to 46em of its card before it stacks the same way: main's wider sidebar (29579b564) left
   the card under the old 48em at 1280 px with the sidebar open and text 15, so the side gap by
   the panel is 4 px Compact only (the shared grid keeps 16 px for List and Cards), the middle
   columns keep 0 side padding, the outer cells keep 6 px at the card edges (so the 4 px focus
   ring never hits the card border or overflow clipping), the Task cell keeps 6 px before Office,
   and the Action cell keeps 6 px after Status while Done trims its inline padding to give room
   back so a normal title stays on two lines.
   The in-flow grip (t9-area-take-fix1) takes about 22 px from the Task column, with 2 px between
   the grip (or empty grip slot) and dot and 4 px between the dot and title: a normal title stays
   on two lines at 1280 px with the sidebar open and text size 15, and at 1000 px with the sidebar
   collapsed and text size 13. The Area column keeps its 5em, so an ordinary area name stays on
   one line. No non-empty column goes under 40 px.
   Only while the panel shows: without it t2's widths and stacking above apply.
   All of this is scoped to the Compact table: List and Cards keep their own looks. */
.tasks-with-handto:has(> .tasks-handto) .tasks-compact-card {
  container-name: tasks-compact-handto;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact th,
.tasks-with-handto:has(> .tasks-handto) .tasks-compact td {
  padding-inline: 0;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact th:first-child,
.tasks-with-handto:has(> .tasks-handto) .tasks-compact td:first-child {
  padding-left: 6px;
  padding-right: 6px;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact th:last-child,
.tasks-with-handto:has(> .tasks-handto) .tasks-compact td:last-child {
  padding-left: 6px;
  padding-right: 6px;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact-task {
  min-width: 0;
}

/* The grip (or empty grip slot), the dot and the title stay in the flow (2 px grip-to-dot and
   4 px dot-to-title in table mode), and the middle padding, status badge, assign and done buttons
   and due column give room back, so a normal title fits two lines. The Area column stays 5em: its
   tag wraps (long names grow it), so shrinking it broke ordinary names like "Hygiene" mid-word. */
.tasks-with-handto:has(> .tasks-handto) .tasks-compact-task > div {
  gap: 1px;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact .tasks-person {
  gap: 6px;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact-office {
  width: 4.5em;
  white-space: normal;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact-person {
  width: 7em;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact-due {
  width: 7em;
  font-size: round(nearest, calc(12px * var(--font-scale)), 1px);
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact-status .badge {
  padding-inline: 1px;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact-action .tasks-assign-btn {
  padding-inline: 1px;
}

.tasks-with-handto:has(> .tasks-handto) .tasks-compact-area {
  width: 5em;
  max-width: 5em;
}

/* Table-only spacing for Compact beside the panel: stacked rows (max-width: 46em) keep their
   own grip gap, dot margin and Done button padding. */
@container tasks-compact-handto (width > 46em) {
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-task > div {
    gap: 2px;
  }

  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-task .dot {
    margin-right: 2px;
  }

  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-action .btn:not(.tasks-assign-btn) {
    padding-inline: 5px;
  }
}

@container tasks-compact-handto (max-width: 46em) {
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact,
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact tbody,
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact tr {
    display: block;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact tr {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, auto) auto minmax(0, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 8px;
    padding: 12px 16px;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact tr:has(.tasks-late) {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto minmax(0, 0.5fr) minmax(0, 0.5fr) auto;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact tbody tr + tr {
    border-top: 1px solid var(--line);
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact tbody tr + tr td {
    border-top: 0;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact td,
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact td:first-child,
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact td:last-child {
    padding: 0;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-task {
    grid-row: 1;
    grid-column: 1 / -1;
    min-width: 0;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact .tasks-number {
    display: inline;
    margin-left: 6px;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-inline-urgent {
    display: inline-block;
    margin-left: 6px;
    vertical-align: baseline;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-due > .badge.urgent {
    display: none;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-person,
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-due,
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-office,
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-area {
    grid-row: 2;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-person {
    grid-column: 1;
    width: auto;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-person .tasks-person {
    display: inline-flex;
    max-width: 100%;
    white-space: nowrap;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-person .tasks-person > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-due {
    grid-column: 2;
    width: auto;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-status {
    grid-row: 2;
    grid-column: 3;
    white-space: nowrap;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-office {
    grid-column: 4;
    width: auto;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-area {
    grid-column: 5;
    width: auto;
    max-width: 100%;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-area .badge.tasks-area-tag {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-action {
    grid-row: 2;
    grid-column: 6;
    justify-self: end;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-action .tasks-assign-btn {
    display: inline-flex;
    margin: 0 6px 0 0;
  }
  .tasks-with-handto:has(> .tasks-handto) .tasks-compact-action:empty {
    display: none;
  }
}

/* Cards: two columns on a computer, one on a phone. Urgent or late work has a red edge. */
.tasks-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tasks-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
}

.tasks-card-alert {
  border-left: 3px solid var(--danger);
}

.tasks-card-meta,
.tasks-card-tags {
  margin: 0;
  overflow-wrap: anywhere;
}

.tasks-card-meta {
  color: var(--muted);
  font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
}

.tasks-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tasks-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: auto;
  padding-top: 4px;
}

/* Its own line when the name doesn't fit beside the status and Done, rather than squeezed. */
.tasks-card-foot .tasks-person {
  flex: auto;
}

@media (max-width: 860px) {
  .tasks-cards {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Three choices in one row, each tall enough to tap. */
  .segmented.tasks-layout-pills {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .segmented.tasks-layout-pills button {
    min-height: 44px;
  }
}

/* Hand to (web/js/views/tasks-handto.js): a panel beside the tasks on a computer. It stays in view
   while the tasks scroll and scrolls inside itself when it is taller than the screen. */
.tasks-with-handto:has(> .tasks-handto) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

/* The Compact card is the narrowest, so only it closes the card-to-panel gap to 4 px; List and
   Cards keep the 16 px. The grid is shared, so this goes on a :has(.tasks-compact-card) selector
   that only matches while Compact shows tasks (views/tasks-layouts.js). */
.tasks-with-handto:has(> .tasks-handto):has(.tasks-compact-card) {
  column-gap: 4px;
}

.tasks-main {
  min-width: 0;
  container: tasks-main / inline-size;
}

/* Tasks tab List short row (R10): one line when tasks-main > 600 px, two lines at 600 px or
   narrower. Scoped to .tasks-list-row so shared .work-row / .work-item-row (Leads, Cases,
   desktop Assigned) stay unchanged. */
.tasks-list-row > .row {
  padding: 7px 10px 7px 22px;
  gap: 8px;
}

.tasks-list-row > .row > .dot {
  align-self: center;
  margin-top: 0;
}

.tasks-list-row > .row > .grow {
  display: grid;
  grid-template-columns: fit-content(55%) minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.tasks-list-row > .row > .grow:has(.tasks-late) {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}

.tasks-list-row > .row .title {
  min-width: 8em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tasks-list-row > .row > .grow:has(.tasks-late) .title {
  flex: 1 1 8em;
  min-width: 8em;
  max-width: max-content;
}

.tasks-list-row > .row .meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
}

.tasks-list-row > .row > .grow:has(.tasks-late) .meta {
  flex: 1 1 19em;
  min-width: 0;
  max-width: max-content;
  overflow: hidden;
}

.tasks-list-row .tasks-meta-narrow {
  display: none;
}

.tasks-list-row .tasks-meta-wide {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tasks-list-row .tasks-meta-wide.is-late {
  display: flex;
  align-items: baseline;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.tasks-list-row .tasks-meta-lead,
.tasks-list-row .tasks-meta-tail {
  flex: 0 9999 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tasks-list-row .tasks-meta-wide.is-late .tasks-meta-sep {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: pre;
}

.tasks-list-row .tasks-meta-wide.is-late .tasks-late {
  flex: none;
  max-width: 100%;
  white-space: normal;
}

/* At 600 px or narrower (phone or narrow computer beside Hand-to): two lines.
   Line 1: dot, title (up to two lines then ellipsis), Urgent and status badges.
   Line 2: due (red & never cut when late), assignee, number, office, area, with Assign & Done at right. */
@container tasks-main (max-width: 600px) {
  .tasks-list-row {
    display: block;
    position: relative;
  }
  .tasks-list-row > .row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1px 4px;
    width: 100%;
    padding: 0 6px;
  }
  .tasks-list-row:has(> .tasks-drag-grip) > .row {
    padding-left: 18px;
  }
  .tasks-list-row > .row > .dot {
    align-self: flex-start;
    margin-top: 4px;
  }
  .tasks-list-row > .row > .grow,
  .tasks-list-row > .row > .grow:has(.tasks-late) {
    display: contents;
  }
  .tasks-list-row > .row .title,
  .tasks-list-row > .row > .grow:has(.tasks-late) .title {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: round(nearest, calc(15px * var(--font-scale)), 1px);
    --lh: 1.15;
    line-height: 1.15;
  }
  .tasks-list-row > .row > .badge {
    flex: none;
    margin-left: 0;
    padding: 1px 4px;
    --lh: 1.2;
    line-height: 1.2;
  }
  .tasks-list-row > .row .meta,
  .tasks-list-row > .row > .grow:has(.tasks-late) .meta {
    order: 2;
    flex: 1 0 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    overflow: visible;
    font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
    --lh: 1.2;
    line-height: 1.2;
  }
  .tasks-list-row .tasks-meta-wide,
  .tasks-list-row .tasks-meta-wide.is-late {
    display: none;
  }
  .tasks-list-row .tasks-meta-narrow {
    display: block;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tasks-list-row .tasks-meta-narrow.is-late {
    display: block;
    overflow: visible;
    white-space: normal;
    overflow-wrap: normal;
    font-size: round(nearest, calc(12px * var(--font-scale)), 1px);
    --lh: 1.1;
    line-height: 1.1;
  }
  .tasks-list-row .tasks-meta-narrow.is-late .tasks-late {
    display: inline-block;
    width: 100%;
    vertical-align: top;
    white-space: normal;
  }
  .tasks-list-row .tasks-meta-narrow.is-late .tasks-meta-sep {
    display: inline-block;
    width: 0;
    height: 0;
    overflow: hidden;
    vertical-align: top;
    white-space: pre;
    font-size: 0;
    line-height: 0;
  }
  .tasks-list-row .tasks-meta-narrow.is-late .tasks-meta-rest {
    display: inline-block;
    vertical-align: top;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tasks-list-row:has(> .btn) > .row .meta {
    min-height: 45px;
  }
  .tasks-list-row:has(> .btn) > .row > .grow:has(.tasks-late) .meta {
    display: block;
    min-height: 0;
    padding-right: 0;
  }
  .tasks-list-row:has(> .btn) .tasks-meta-narrow.is-late .tasks-meta-rest {
    margin-top: 22px;
    margin-bottom: 13px;
  }
  .tasks-list-row:has(> .tasks-assign-btn):has(> button:not(.tasks-assign-btn)) > .row .meta {
    padding-right: 150px;
  }
  .tasks-list-row:has(> .tasks-assign-btn):not(:has(> button:not(.tasks-assign-btn))) > .row .meta {
    padding-right: 80px;
  }
  .tasks-list-row:not(:has(> .tasks-assign-btn)):has(> button) > .row .meta {
    padding-right: 72px;
  }
  .tasks-list-row:has(> .tasks-assign-btn):has(> button:not(.tasks-assign-btn)) .tasks-meta-narrow.is-late .tasks-meta-rest {
    max-width: calc(100% - 150px);
  }
  .tasks-list-row:has(> .tasks-assign-btn):not(:has(> button:not(.tasks-assign-btn))) .tasks-meta-narrow.is-late .tasks-meta-rest {
    max-width: calc(100% - 80px);
  }
  .tasks-list-row:not(:has(> .tasks-assign-btn)):has(> button) .tasks-meta-narrow.is-late .tasks-meta-rest {
    max-width: calc(100% - 72px);
  }
  .tasks-list-row.work-item-row > button.btn,
  .tasks-list-row > button.btn {
    position: absolute;
    bottom: 0;
    margin: 0;
    padding-inline: 6px;
    width: auto;
    min-width: 64px;
  }
  .tasks-list-row > .tasks-assign-btn:has(~ button:not(.tasks-assign-btn)) {
    right: 78px;
  }
  .tasks-list-row > .tasks-assign-btn:not(:has(~ button:not(.tasks-assign-btn))),
  .tasks-list-row > button:last-of-type {
    right: 6px;
  }
  .tasks-list-row > .tasks-assign-space,
  .tasks-list-row > .row-action-space {
    display: none;
  }
}


.tasks-handto {
  position: sticky;
  top: 16px;
  width: 220px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
}

.tasks-handto h2 {
  margin: 0;
  font-size: round(nearest, calc(15px * var(--font-scale)), 1px);
}

.tasks-handto h3 {
  margin: 14px 0 4px;
  color: var(--muted);
  font-size: round(nearest, calc(11px * var(--font-scale)), 1px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tasks-handto-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
}

.tasks-handto-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-weight: 600;
}

.tasks-handto-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tasks-handto-people .tasks-handto-row {
  min-height: 44px;
}

.tasks-handto-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  overflow-wrap: anywhere;
}

.tasks-handto-row .grow {
  flex: 1;
  min-width: 0;
}

.tasks-handto-row.drop-target {
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.tasks-handto-row.tasks-handto-unavailable {
  opacity: .5;
}

.tasks-handto-unavailable-note {
  display: block;
  color: var(--muted);
  font-size: round(nearest, calc(12px * var(--font-scale)), 1px);
}

.tasks-handto-drop {
  flex: none;
  color: var(--accent-ink);
  font-size: round(nearest, calc(12px * var(--font-scale)), 1px);
  font-weight: 650;
}

.tasks-handto .person-avatar,
.tasks-handto-swatch {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-avatar);
  background: var(--person-colour);
  color: #ffffff;
  font-size: round(nearest, calc(11px * var(--font-scale)), 1px);
  font-weight: 700;
  --lh: 1;
}

.tasks-handto .tasks-handto-nobody {
  border: 1.5px dashed var(--line-strong);
  background: transparent;
  color: var(--muted);
}

.tasks-handto-swatch {
  background: var(--brand);
  box-shadow: inset 0 0 0 7px var(--surface);
  outline: 1px solid var(--line-strong);
}

.tasks-handto-swatch.none {
  background: var(--surface-2);
}

.tasks-handto-members {
  display: block;
  color: var(--muted);
  font-size: round(nearest, calc(12px * var(--font-scale)), 1px);
}

.tasks-handto-count {
  flex: none;
  min-width: 24px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  font-size: round(nearest, calc(12px * var(--font-scale)), 1px);
  font-weight: 600;
  text-align: center;
}

.tasks-handto-add {
  margin-top: 8px;
}

/* Assign (web/js/views/tasks-assign.js): a button on every task the viewer may change, beside
   Done, and the Assign list it opens, a bottom sheet on phones (styles.css .message-sheet). Take it,
   on a task the viewer may only take, sits in Assign's place with the same look. */
/* List: Assign has a set width, and rows without it keep the same room, so badges line up. */
.work-item-row > .tasks-assign-btn,
.work-item-row > .tasks-assign-space {
  width: 76px;
  margin-right: 0;
}

.work-item-row.tasks-no-done-space > .tasks-take-btn,
.work-item-row.tasks-no-done-space > .tasks-assign-space {
  margin-right: 16px;
}

/* Compact on a computer: Assign above Done, so the column is no wider than before. */
.tasks-compact-action .tasks-assign-btn {
  display: block;
  margin-bottom: 4px;
  padding-inline: 6px;
}

.tasks-assign-title {
  margin: 4px 0 2px;
  font-weight: 600;
}

.tasks-assign-facts,
.tasks-assign-note,
.tasks-assign-hint {
  margin: 0 0 4px;
  color: var(--muted);
}

.dialog.tasks-assign h3 {
  margin: 16px 0 4px;
  color: var(--muted);
  font-size: round(nearest, calc(12px * var(--font-scale)), 1px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tasks-assign-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tasks-assign-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tasks-assign-choice:hover,
.tasks-assign-choice:focus-visible {
  background: var(--accent-soft);
}

.tasks-assign-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.tasks-assign-current,
.tasks-assign-count {
  flex: none;
  color: var(--muted);
  font-size: round(nearest, calc(13px * var(--font-scale)), 1px);
}

.tasks-assign-choice[aria-current="true"] .tasks-assign-current {
  color: var(--accent);
  font-weight: 600;
}

.tasks-assign-add {
  margin-top: 8px;
}

.tasks-assign-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

@media (max-width: 860px) {
  /* Compact stacked on a phone: Assign and Done side by side at right of Line 2. */
  .tasks-compact-action .tasks-assign-btn {
    display: inline-flex;
    margin: 0 6px 0 0;
  }
  .tasks-assign-btn,
  .tasks-list-row > .btn,
  .tasks-compact-action .btn,
  .tasks-card-foot .btn,
  .tasks-assign-add {
    min-height: 44px;
  }
  .tasks-assign-foot .btn {
    flex: 1;
    min-height: 44px;
  }
}
