/* ==================================================================================================
   Hub screens — owner: hub agent
   Home (.home) · Inbox (.inbox-page, .inbox-*) · bell popover (.notif-bell, .notif-popover, .pop-item)
   Activity entries (.activity-item, .activity-day — shared partials, used in drawers too) and the
   feed page (.activity-page) · Search (.search-page, .search-item) · command palette (.palette)
   Insights (.insights-page, .chart-card, .split, .bar-list) · Workload (.workload-page, .wl-*)
   Shared bits: .filter-bar (core toolbar) + .scope-filter popover, .load-more, .chart-legend.
   Tokens only (app.css); decorative motion lives inside prefers-reduced-motion: no-preference.
   ================================================================================================== */

/* -- Filter bar: a core .toolbar (range · Filter popover ··· period / Sort) + active-filter chips -- */
.filter-bar {
  margin-bottom: var(--space-4);
}
.filter-bar + .active-filters {
  margin-top: calc(var(--space-2) * -1);
  margin-bottom: var(--space-4);
}
.filter-bar__note {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* The scope filter popover: two columns (Team · Project), three with Person. */
.scope-filter {
  width: min(480px, calc(100vw - 16px));
}
.scope-filter--3 {
  width: min(720px, calc(100vw - 16px));
}
@media (max-width: 639px) {
  .filter-bar {
    flex-wrap: wrap;
    row-gap: var(--space-2);
  }
  .filter-bar__note {
    flex-basis: 100%;
    order: 3;
  }
}

/* -- Load more ----------------------------------------------------------------------------------- */
.load-more {
  display: flex;
  justify-content: center;
  padding: var(--space-4) 0 var(--space-2);
}
.load-more__button {
  position: relative;
  min-width: 160px;
}
/* r4 · 9.17: while the next chunk loads, the label gives way to the activity indicator */
.load-more__spinner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.load-more__button.htmx-request .btn__label {
  opacity: 0;
}

/* -- Chart legends (swatch colors are the single source for the canvases: insights.js) ----------- */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 var(--space-3);
  padding: 0;
  color: var(--text-2);
  font-size: var(--fs-xs);
  list-style: none;
}
.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart-legend__swatch {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--swatch, var(--accent));
}
/* Series colors: the shared chart tokens where they exist (readable on dark cards), else the palette */
[data-series="created"] { --swatch: light-dark(color-mix(in srgb, var(--c-gray) 42%, var(--surface)), color-mix(in srgb, var(--c-gray) 62%, var(--surface))); }
[data-series="completed"] { --swatch: var(--chart-strong, var(--accent)); }
[data-series="not_started"] { --swatch: var(--chart-muted, color-mix(in srgb, var(--accent) 36%, var(--surface))); }
[data-series="in_progress"] { --swatch: var(--chart-strong, var(--accent)); }
[data-series="priorities-4"] { --swatch: var(--c-red); }
[data-series="priorities-3"] { --swatch: var(--c-orange); }
[data-series="priorities-2"] { --swatch: var(--c-yellow); }
[data-series="priorities-1"] { --swatch: var(--c-gray); }
[data-series="priorities-0"] { --swatch: light-dark(color-mix(in srgb, var(--c-gray) 34%, var(--surface)), color-mix(in srgb, var(--c-gray) 50%, var(--surface))); }
[data-series="types-task"] { --swatch: var(--c-gray); }
[data-series="types-bug"] { --swatch: var(--c-red); }
[data-series="types-feature"] { --swatch: var(--c-purple); }
[data-series="types-improvement"] { --swatch: var(--c-blue); }
[data-series="types-milestone"] { --swatch: var(--c-orange); }

/* -- Activity entries (shared partials) ---------------------------------------------------------- */
/* Timeline: a tinted verb marker on a thread line (what happened), then the sentence with a small
   inline avatar (who). Runs of similar entries collapse into one with a "N more like this" list. */
.activity-day + .activity-day {
  margin-top: var(--space-5);
}
.activity-day:not(:has(> .activity-day__label)) {
  margin-top: 0;
}
.activity-day__label {
  margin: 0 0 var(--space-1);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.activity-day__items {
  position: relative;
  display: flex;
  flex-direction: column;
}
.activity-item {
  --marker: 28px;
  --pad: 9px;
  position: relative;
  display: grid;
  grid-template-columns: var(--marker) minmax(0, 1fr);
  gap: 12px;
  padding: var(--pad) 0;
}
.activity-item--compact {
  --marker: 24px;
  --pad: 7px;
  gap: 10px;
}
/* Thread line linking the markers of one day. */
.activity-day__items > .activity-item:not(:last-child)::before {
  content: "";
  position: absolute;
  top: calc(var(--pad) + var(--marker) + 3px);
  bottom: calc(var(--pad) * -1 + 3px);
  left: calc(var(--marker) / 2 - 0.5px);
  width: 1px;
  background: var(--line);
}
.activity-item__marker {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--marker);
  height: var(--marker);
  border-radius: 50%;
  background: var(--fill-1);
  color: var(--text-2);
}
/* r3 "color only for meaning": the verb glyph is neutral; done (green) and deleted (red) keep
   their tone. */
.activity-item__marker[data-color="green"],
.activity-item__marker[data-color="red"] {
  background: var(--tone-soft);
  color: var(--tone-ink);
}
/* A bundle is a little stack of markers. */
.activity-item--bundle .activity-item__marker {
  box-shadow:
    0 0 0 2px var(--surface),
    3px 3px 0 2px var(--fill-1);
}
/* r4 · 12.4: feeds lead with the actor (24 px avatar) and a small verb badge in the event's tone;
   no thread line between avatars (a calm list, like Activity in Apple apps). */
.activity-item:has(> .activity-item__marker--avatar) {
  --marker: 24px;
}
.activity-item__marker--avatar {
  background: none;
}
.activity-item__marker--avatar > .avatar {
  --size: var(--marker);
}
.activity-item__verb {
  position: absolute;
  right: -4px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tone-solid);
  box-shadow: 0 0 0 1.5px var(--row-bg, var(--surface));
  color: var(--tone-on);
}
.activity-item__verb .icon {
  width: 8px;
  height: 8px;
}
.activity-day__items > .activity-item:has(> .activity-item__marker--avatar)::before {
  content: none;
}
.activity-item--bundle .activity-item__marker--avatar {
  box-shadow: none;
}
.activity-item--bundle .activity-item__marker--avatar > .avatar {
  box-shadow: 3px 3px 0 0 var(--fill-2);
}
.activity-item__body {
  min-width: 0;
  padding-top: calc((var(--marker) - 1.5em) / 2);
}
.activity-item__text {
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-md);
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.activity-item--compact .activity-item__text {
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.activity-item__text > .avatar,
.activity-item__system {
  margin-right: 6px;
  vertical-align: -5px;
}
.activity-item--compact .activity-item__text > .avatar,
.activity-item--compact .activity-item__system {
  --size: 18px;
  margin-right: 5px;
  vertical-align: -4px;
  font-size: 8px;
}
.activity-item__system {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fill-2);
  color: var(--text-2);
}
.activity-item--compact .activity-item__system {
  width: 18px;
  height: 18px;
}
.activity-item__text strong {
  color: var(--text);
  font-weight: var(--fw-semibold);
}
.activity-item__text a,
.activity-bundle__text a {
  color: var(--text);
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: color var(--dur-1) ease;
}
.activity-item__text a:hover,
.activity-bundle__text a:hover {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 2px;
}
.activity-item__details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 0;
  padding: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
  list-style: none;
}
.activity-item__quote {
  display: -webkit-box;
  margin: 6px 0 0;
  padding: 2px 0 2px 10px;
  overflow: hidden;
  border-left: 2px solid var(--tone-line, var(--line-strong));
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.activity-item__quote--compact {
  margin-top: 4px;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.activity-item__time {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.activity-item__text > .activity-item__time {
  display: inline;
  margin: 0 0 0 2px;
  white-space: nowrap;
}
.activity-item__text > .activity-item__time::before {
  content: "· ";
}
.activity-item[data-panel-url] .activity-item__text a,
.activity-bundle__item[data-panel-url] a {
  cursor: pointer;
}

/* "N more like this" */
.activity-bundle {
  margin-top: 4px;
}
.activity-bundle__toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: -6px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: var(--accent-ink);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.activity-bundle__toggle::-webkit-details-marker {
  display: none;
}
.activity-bundle__toggle::after {
  content: "";
  width: 9px;
  height: 9px;
  background: currentColor;
  -webkit-mask: var(--chevron-mask) center / contain no-repeat;
  mask: var(--chevron-mask) center / contain no-repeat;
  transform: rotate(90deg);
  transition: transform var(--dur-2) var(--ease-out);
}
.activity-bundle[open] > .activity-bundle__toggle::after {
  transform: rotate(-90deg);
}
.activity-bundle__toggle:hover {
  background: var(--accent-softer);
}
.activity-bundle__toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.activity-bundle__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 2px;
  padding: 0 0 0 10px;
  border-left: 2px solid var(--line);
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.45;
  list-style: none;
}
.activity-item--compact .activity-bundle__list {
  font-size: var(--fs-xs);
}
.activity-bundle__item .activity-item__time {
  display: inline;
  white-space: nowrap;
}
.activity-bundle__item .activity-item__time::before {
  content: "· ";
}
@media (prefers-reduced-motion: no-preference) {
  .activity-bundle[open] .activity-bundle__item {
    animation: activity-bundle-in var(--dur-2) var(--ease-out) both;
  }
}
@keyframes activity-bundle-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
}

/* Activity feed page (r4 · 12.4): each day is an inset grouped card under a sticky glass label */
.activity-page .activity-day__label {
  position: sticky;
  z-index: 2;
  top: calc(var(--topbar-h) + var(--safe-top, 0px));
  margin: 0 calc(var(--space-2) * -1) var(--space-1);
  padding: 7px calc(var(--space-2) + 12px) 6px;
  /* the canvas, frosted: invisible at rest, glass once the day scrolls beneath it */
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  color: var(--text-2);
  font-size: var(--type-footnote);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.activity-page .activity-day__items {
  padding: 4px 16px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow:
    0 0 0 0.5px var(--card-ring),
    var(--shadow-xs);
}
.activity-page .activity-item {
  --row-bg: var(--surface);
  padding-block: 10px;
}
/* Hairlines between entries, starting at the text (iOS) */
.activity-page .activity-item + .activity-item::after {
  content: "";
  position: absolute;
  top: 0;
  right: -16px;
  left: calc(var(--marker) + 12px);
  height: 0.5px;
  background: var(--line);
}
.activity-page .activity-day:not(:has(> .activity-day__label)) .activity-day__items {
  margin-top: -1px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.activity-page .activity-day:has(+ .activity-day:not(:has(> .activity-day__label))) .activity-day__items {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
@media (max-width: 639px) {
  .activity-page .activity-day__items {
    padding: 2px 14px;
  }
  .activity-page .activity-item + .activity-item::after {
    right: -14px;
  }
}

/* -- Inbox ---------------------------------------------------------------------------------------
   r4 · 12.3 (Mail): a large title, a sticky scope bar (segmented control ≥ 1024 px, scrolling chips
   below), one list card with sticky glass day headers; rows lead with a blue unread dot and a
   32 px avatar / squircle, hover actions float in a glass capsule, right click opens "More
   actions" (10.3), swipe left (touch) reveals a blue action tile (11.2 look). */
.inbox-page {
  --content-max: 920px;
  --inbox-bar-h: 52px;
}
.inbox-header {
  margin-bottom: var(--space-2);
}
.inbox-body {
  position: relative;
}
.inbox-toolbar {
  position: sticky;
  z-index: var(--z-sticky);
  top: calc(var(--topbar-h) + var(--safe-top, 0px));
  margin: calc(var(--space-2) * -1) calc(var(--space-2) * -1) var(--space-2);
  padding: var(--space-2);
  /* the canvas color, frosted: invisible at rest, glass once rows scroll beneath */
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
}
.inbox-toolbar > .toolbar {
  min-height: 36px;
}
/* Filters: one strip that scrolls sideways (fade edges) when it doesn't fit. */
.inbox-filters {
  flex: 0 1 auto;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.inbox-filters::-webkit-scrollbar {
  display: none;
}
.inbox-filters .toolbar__sep {
  display: none;
}
/* Phones / tablets: capsule chips (filled), the current one in the accent. */
.inbox-filters .inbox-tab {
  height: 32px;
  padding: 0 12px;
  border: 0;
  background: var(--fill-1);
  color: var(--text);
  font-weight: var(--fw-medium);
}
.inbox-filters .inbox-tab:hover {
  background: var(--fill-2);
}
.inbox-tab .icon {
  color: var(--text-2);
}
.inbox-filters .inbox-tab.is-active,
.inbox-filters .inbox-tab.is-active:hover {
  background: var(--accent);
  color: var(--text-on-accent);
}
.inbox-tab.is-active .icon {
  color: currentColor;
}
/* Counters: Unread is a filled accent badge; the rest are quiet numbers. */
.inbox-tab .inbox-tab__count {
  min-width: 18px;
  height: 18px;
  margin: 0 -4px 0 0;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--fill-2);
  color: var(--text-2);
  font-size: var(--type-caption2);
  font-weight: var(--fw-semibold);
  line-height: 1;
}
.inbox-tab .inbox-tab__count--unread {
  background: var(--accent);
  color: var(--text-on-accent);
}
.inbox-tab.is-active .inbox-tab__count {
  background: rgb(255 255 255 / 0.24);
  color: inherit;
}
/* Desktop: a macOS segmented control (track + white thumb on the current scope). */
@media (min-width: 1024px) {
  .inbox-filters {
    gap: 0;
    height: 32px;
    padding: 2px;
    border-radius: var(--radius-full);
    background: var(--segmented-bg, var(--fill-2));
  }
  .inbox-filters .inbox-tab {
    height: 28px;
    padding: 0 12px;
    background: transparent;
    color: var(--text-2);
  }
  .inbox-filters .inbox-tab:hover {
    background: transparent;
    color: var(--text);
  }
  .inbox-filters .inbox-tab:active {
    transform: none;
    opacity: 0.7;
  }
  .inbox-filters .inbox-tab.is-active,
  .inbox-filters .inbox-tab.is-active:hover {
    background: var(--segmented-thumb);
    box-shadow: var(--segmented-thumb-shadow);
    color: var(--text);
    font-weight: var(--fw-semibold);
  }
  .inbox-filters .inbox-tab.is-active .inbox-tab__count:not(.inbox-tab__count--unread) {
    background: var(--fill-1);
    color: var(--text-2);
  }
  .inbox-filters .inbox-tab.is-active .inbox-tab__count--unread {
    background: var(--accent);
    color: var(--text-on-accent);
  }
  /* separators between unselected segments (macOS) */
  .inbox-filters .inbox-tab + .inbox-tab:not(.is-active)::before,
  .inbox-filters .toolbar__sep + .inbox-tab:not(.is-active)::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    width: 0.5px;
    background: var(--line-strong);
  }
  .inbox-filters .inbox-tab.is-active + .inbox-tab::before,
  .inbox-filters .inbox-tab.is-active + .toolbar__sep + .inbox-tab::before {
    content: none;
  }
}
.inbox-toolbar__action {
  flex-shrink: 0;
}
.inbox-markall {
  color: var(--accent-ink);
}
/* Bulk bar: takes the filters' place while rows are selected */
.inbox-bulk[hidden],
.inbox-body.has-selection .inbox-toolbar__filters {
  display: none;
}
.inbox-bulk {
  min-height: 36px;
  padding: 2px 4px;
  border: 0.5px solid var(--glass-border);
  border-radius: var(--radius-full);
  background: var(--glass-sheen), var(--mat-thick);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  box-shadow: var(--glass-rim), var(--shadow-md);
}
.inbox-bulk__count {
  padding-inline: 4px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (prefers-reduced-motion: no-preference) {
  .inbox-bulk:not([hidden]) {
    animation: inbox-drop var(--dur-snappy) var(--spring-snappy) both;
  }
}

/* "New notifications" pill (live arrivals while you are scrolled down) */
.inbox-fresh {
  position: sticky;
  z-index: calc(var(--z-sticky) + 1);
  top: calc(var(--topbar-h) + var(--safe-top, 0px) + var(--inbox-bar-h) + 6px);
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin: 0 auto var(--space-3);
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--accent);
  box-shadow: var(--shadow-md);
  color: var(--text-on-accent);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}
.inbox-fresh[hidden] {
  display: none;
}
.inbox-fresh:hover {
  background: var(--accent-hover);
}
.inbox-fresh:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px var(--focus-ring),
    var(--shadow-md);
}
@media (prefers-reduced-motion: no-preference) {
  .inbox-fresh:not([hidden]) {
    animation: inbox-drop var(--dur-bouncy) var(--spring-bouncy) both;
  }
}
@keyframes inbox-drop {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.92);
  }
}

/* One list card; the groups (Today / Yesterday / This week / Earlier) get sticky glass headers. */
.inbox-list:has(.inbox-group) {
  overflow: clip;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow:
    0 0 0 0.5px var(--card-ring),
    var(--shadow-xs);
}
.inbox-group__label {
  position: sticky;
  z-index: 4;
  top: calc(var(--topbar-h) + var(--safe-top, 0px) + var(--inbox-bar-h));
  margin: 0;
  padding: 7px 16px 6px 76px;
  background: var(--mat-chrome);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  box-shadow: 0 0.5px 0 var(--line);
  color: var(--text-2);
  font-size: var(--type-footnote);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.inbox-list .load-more {
  margin: 0;
  padding: var(--space-3);
  border-top: 0.5px solid var(--line);
}

/* Row: (checkbox | unread dot) · avatar (+ verb badge) · sentence + time · preview · project */
.inbox-item {
  --swipe-x: 0px;
  --row-bg: var(--surface);
  position: relative;
  display: flex;
  align-items: stretch;
  overflow: clip;
  background: var(--row-bg);
  touch-action: pan-y;
  transition: background-color var(--dur-1) ease;
}
.inbox-item + .inbox-item::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  left: 72px;
  height: 0.5px;
  background: var(--line);
}
.inbox-item:hover,
.inbox-item:focus-within {
  --row-bg: color-mix(in srgb, var(--fill-1) 60%, var(--surface));
}
.inbox-item.is-selected {
  --row-bg: var(--accent-softer);
}
.inbox-item__link {
  position: relative;
  z-index: 1;
  display: grid;
  flex: 1;
  grid-template-columns: 12px 32px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px 12px 8px;
  background: var(--row-bg);
  color: inherit;
  text-decoration: none;
  transform: translateX(var(--swipe-x));
  transition: background-color var(--dur-1) ease;
}
.inbox-item__link:focus-visible {
  outline: 2.5px solid var(--focus-outline);
  outline-offset: -2.5px;
}
.inbox-item__dot {
  justify-self: center;
  width: 9px;
  height: 9px;
  margin-top: 11px;
  border-radius: 50%;
  background: var(--info);
  opacity: 0;
  transform: scale(0.3);
  transition:
    opacity var(--dur-2) ease,
    transform var(--dur-snappy) var(--spring-bouncy);
}
.inbox-item.is-unread .inbox-item__dot {
  opacity: 1;
  transform: none;
}
/* Selection checkbox: sits on the dot; shows on hover / focus and while anything is selected. */
.inbox-item__check {
  position: absolute;
  z-index: 3;
  top: 19px;
  left: 6px;
  width: 16px;
  height: 16px;
  margin: 0;
  opacity: 0;
  transition: opacity var(--dur-1) ease;
}
.inbox-item:hover .inbox-item__check,
.inbox-item__check:focus-visible,
.inbox-item__check:checked,
.inbox-body.has-selection .inbox-item__check {
  opacity: 1;
}
.inbox-item:hover .inbox-item__dot,
.inbox-item:has(.inbox-item__check:focus-visible) .inbox-item__dot,
.inbox-body.has-selection .inbox-item__dot {
  opacity: 0;
}
/* Touch: no hover — the checkboxes appear once something is selected (long-press opens the menu,
   swipe toggles read). */
@media (hover: none) {
  .inbox-item:hover .inbox-item__check {
    opacity: 0;
  }
  .inbox-body:not(.has-selection) .inbox-item__check {
    pointer-events: none;
  }
  .inbox-item.is-unread:hover .inbox-item__dot {
    opacity: 1;
  }
  .inbox-body.has-selection .inbox-item__check {
    opacity: 1;
  }
}
.inbox-item__lead {
  position: relative;
  width: 32px;
  height: 32px;
}
.inbox-item__tile {
  --size: 32px;
}
/* Verb badge: a small round glyph in the notification's tone (mention, assignment, overdue …). */
.inbox-item__badge {
  position: absolute;
  right: -4px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tone-solid);
  box-shadow: 0 0 0 2px var(--row-bg);
  color: var(--tone-on);
  transition: box-shadow var(--dur-1) ease;
}
.inbox-item__badge[data-verb="mentioned"] {
  background: var(--accent);
  color: var(--text-on-accent);
}
.inbox-item__badge .icon {
  width: 9px;
  height: 9px;
}
.inbox-item__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.inbox-item__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  min-width: 0;
}
.inbox-item__text {
  display: -webkit-box;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--type-body);
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.inbox-item__text strong {
  color: var(--text);
  font-weight: var(--fw-medium);
}
.inbox-item.is-unread .inbox-item__text {
  color: var(--text);
}
.inbox-item.is-unread .inbox-item__text strong {
  font-weight: var(--fw-semibold);
}
.inbox-item__time {
  flex-shrink: 0;
  color: var(--text-3);
  font-size: var(--type-footnote);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: opacity var(--dur-1) ease;
}
.inbox-item.is-unread .inbox-item__time {
  color: var(--text-2);
}
@media (hover: hover) {
  /* the hover actions float over the time column: keep it as wide as they are */
  .inbox-item__time {
    min-width: 96px;
    text-align: right;
  }
}
.inbox-item__excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--type-subhead);
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.inbox-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  min-width: 0;
  margin-top: 2px;
  color: var(--text-3);
  font-size: var(--type-footnote);
}
.inbox-item__project {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.inbox-item__flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--tone-ink);
  font-weight: var(--fw-medium);
}

/* Actions: quick buttons float over the time in a glass capsule on hover / focus (pointer
   devices); touch devices get one "…" menu at the end of the row. */
.inbox-item__actions {
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 10px;
}
.inbox-item__quick {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 0.5px solid var(--glass-border);
  border-radius: var(--radius-full);
  background: var(--glass-sheen), var(--mat-thick);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  box-shadow: var(--glass-rim), var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.94);
  transform-origin: right center;
  transition:
    opacity var(--dur-1) ease,
    transform var(--dur-snappy) var(--spring-snappy);
}
.inbox-item__quick .inbox-item__action {
  border-radius: var(--radius-full);
}
.inbox-item:hover .inbox-item__quick,
.inbox-item:focus-within .inbox-item__quick,
.inbox-item__quick:has([aria-expanded="true"]) {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.inbox-item:hover .inbox-item__time,
.inbox-item:focus-within .inbox-item__time {
  opacity: 0;
}
.inbox-item__action {
  color: var(--text-2);
}
.inbox-item__action:hover {
  color: var(--text);
}
.inbox-item__save[aria-pressed="true"] {
  background: color-mix(in srgb, var(--c-orange) 14%, transparent);
  color: var(--c-orange-ink);
}
.inbox-item__wake {
  color: var(--accent-ink);
}
.inbox-snooze {
  min-width: 248px;
}
.inbox-snooze__hint {
  padding-left: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* r4 · 10.3: on pointer devices the "…" trigger is hidden, but its menu must still render (the
   context menu opens it at the cursor) — hide the button, not the wrapper. */
@media (hover: hover) {
  .inbox-item__more {
    display: contents;
  }
  .inbox-item__more [data-menu-trigger] {
    display: none;
  }
}
@media (hover: none) {
  .inbox-item__actions {
    position: relative;
    top: auto;
    right: auto;
    display: flex;
    align-items: flex-start;
    padding: 8px 6px 0 0;
    background: var(--row-bg);
    transform: translateX(var(--swipe-x));
  }
  .inbox-item__quick {
    display: none;
  }
  .inbox-item__more {
    display: block;
  }
  .inbox-item__more .inbox-item__action {
    color: var(--text-3);
  }
  .inbox-item:hover .inbox-item__time,
  .inbox-item:focus-within .inbox-item__time {
    opacity: 1;
  }
}

/* Swipe left (touch) to toggle read: a blue iOS action tile (icon 20 + caption) grows from the
   right edge as the row slides; past the threshold the glyph pops. */
.inbox-item__swipe {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: flex-start;
  width: max(76px, calc(var(--swipe-x) * -1));
  background: var(--tone-solid);
  color: var(--tone-on);
  opacity: 0;
}
.inbox-item__swipe-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 76px;
  font-size: var(--type-caption);
  font-weight: var(--fw-semibold);
  line-height: 1.1;
  text-align: center;
}
.inbox-item__swipe-tile .icon {
  transition: transform var(--dur-snappy) var(--spring-bouncy);
}
.inbox-item.is-swiping .inbox-item__swipe {
  opacity: 1;
}
.inbox-item.is-swipe-armed .inbox-item__swipe-tile .icon {
  transform: scale(1.2);
}
.inbox-item.is-settling .inbox-item__link,
.inbox-item.is-settling .inbox-item__actions {
  transition: transform var(--dur-snappy) var(--spring-snappy);
}

/* Motion: live arrivals glide in with a soft highlight; snoozed rows slide out */
@media (prefers-reduced-motion: no-preference) {
  .inbox-item.is-arriving {
    animation: inbox-arrive 900ms var(--ease-out) both;
  }
  .inbox-item.is-arriving .inbox-item__link {
    animation: inbox-arrive-bg 1600ms ease-out both;
  }
  .inbox-item.htmx-swapping {
    opacity: 0;
    transform: translateX(-16px);
    transition:
      opacity 160ms ease,
      transform 180ms var(--ease-in, ease-in);
  }
  .pop-item.htmx-swapping {
    opacity: 0;
    transition: opacity 140ms ease;
  }
  /* Inbox zero: the empty glyph pops once (7.8) */
  .inbox-list > .empty-state .empty-state__art {
    animation: pop var(--dur-bouncy) var(--spring-bouncy) both;
  }
}
@keyframes inbox-arrive {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}
@keyframes inbox-arrive-bg {
  from {
    background-color: var(--accent-soft);
  }
}

@media (max-width: 639px) {
  .inbox-toolbar {
    margin-inline: calc(var(--page-pad-x, 16px) * -1);
    padding-inline: var(--page-pad-x, 16px);
  }
  .inbox-list:has(.inbox-group) {
    margin-inline: calc(var(--page-pad-x, 16px) * -1);
    border-radius: 0;
    box-shadow: 0 0.5px 0 var(--line), 0 -0.5px 0 var(--line);
  }
  .inbox-item__link {
    padding: 11px 4px 11px 6px;
    gap: 10px;
  }
  .inbox-item + .inbox-item::before {
    left: 60px;
  }
  .inbox-group__label {
    padding-left: 16px;
  }
  /* Phones: the sentence gets the full width (3 lines); the time moves to the project line. */
  .inbox-item__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px var(--space-2);
  }
  .inbox-item__head {
    display: contents;
  }
  .inbox-item__text {
    grid-area: 1 / 1 / 2 / 3;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  .inbox-item__excerpt {
    grid-area: 2 / 1 / 3 / 3;
  }
  .inbox-item__meta {
    grid-area: 3 / 1 / 4 / 2;
  }
  .inbox-item__time {
    grid-area: 3 / 2 / 4 / 3;
    align-self: center;
  }
}

/* -- Bell + notifications popover ---------------------------------------------------------------- */
.notif-bell {
  position: relative;
}
.notif-bell__button {
  position: relative;
  color: var(--text-2);
}
.notif-bell__badge .badge {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  box-shadow: 0 0 0 2px var(--bg);
  font-size: 10px;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .notif-bell.is-ringing .notif-bell__button .icon {
    animation: bell-ring 900ms var(--ease-out);
    transform-origin: 50% 2px;
  }
  .notif-bell__badge .badge.is-bumped {
    animation: bell-bump 420ms var(--ease-spring);
  }
}
@keyframes bell-ring {
  10% { transform: rotate(14deg); }
  25% { transform: rotate(-12deg); }
  40% { transform: rotate(9deg); }
  55% { transform: rotate(-6deg); }
  70% { transform: rotate(3deg); }
  85% { transform: rotate(-1deg); }
}
@keyframes bell-bump {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.22); }
}
.notif-popover.popover__panel {
  width: min(400px, calc(100vw - 16px));
  max-width: none;
  max-height: min(74vh, 600px);
  padding: 0;
  overflow: hidden;
}
.notif-popover__content {
  display: flex;
  flex-direction: column;
  max-height: min(74vh, 600px);
}
.notif-popover__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 10px 16px;
  border-bottom: 1px solid var(--line);
}
.notif-popover__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-popover__filter {
  flex-shrink: 0;
}
.notif-popover__mark {
  flex-shrink: 0;
  color: var(--accent-ink);
}
.notif-popover__list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.notif-popover__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 12px;
  border-top: 1px solid var(--line);
  color: var(--accent-ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: background-color var(--dur-1) ease;
}
.notif-popover__footer:hover {
  background: var(--fill-1);
}
.notif-popover__footer:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}
.notif-popover__loading {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 16px;
}
.notif-popover__skeleton {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.notif-popover__skeleton-lines {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
}
.notif-popover__skeleton-lines .skeleton:last-child {
  width: 46%;
}
.notif-popover .empty-state {
  padding-block: var(--space-8);
}
.pop-item {
  --row-bg: transparent;
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
  transition: background-color var(--dur-1) ease;
}
.pop-item:hover {
  background: var(--fill-1);
}
.pop-item__link {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: inherit;
  color: inherit;
}
.pop-item__link:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}
.pop-item__lead {
  position: relative;
  flex-shrink: 0;
  margin-top: 1px;
}
.pop-item__badge {
  position: absolute;
  right: -4px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--tone-solid);
  box-shadow: 0 0 0 2px var(--surface-overlay, var(--surface));
  color: var(--tone-on);
}
.pop-item__badge .icon {
  width: 8px;
  height: 8px;
}
.pop-item__body {
  flex: 1;
  min-width: 0;
}
.pop-item__text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.pop-item__text strong {
  color: var(--text);
  font-weight: var(--fw-medium);
}
.pop-item.is-unread .pop-item__text strong {
  font-weight: var(--fw-semibold);
}
.pop-item__excerpt {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pop-item__time {
  display: block;
  margin-top: 3px;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.pop-item.is-unread .pop-item__time {
  color: var(--accent-ink);
}
.pop-item__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  transition: opacity var(--dur-1) ease;
}
/* r4: the Mail unread dot is blue (--info), like the inbox rows */
.pop-item.is-unread .pop-item__dot {
  background: var(--info);
}
.pop-item__toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  color: var(--text-2);
  opacity: 0;
  translate: 0 -50%;
  transition: opacity var(--dur-1) ease;
}
.pop-item:hover .pop-item__toggle,
.pop-item__toggle:focus-visible {
  opacity: 1;
}
.pop-item:hover .pop-item__dot,
.pop-item:has(.pop-item__toggle:focus-visible) .pop-item__dot {
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .pop-item.is-arriving {
    animation: inbox-arrive 700ms var(--ease-out) both;
  }
}

/* -- KPI widgets (dashboard/partials/kpi.html: home, insights, workload) --------------------------
   r4 · 9.10 / 12.16: iOS widgets — radius 22, white on the grey canvas, a colored round glyph,
   the number in SF Rounded. Each tile spans three rows of the .kpis grid and adopts them (subgrid):
   labels, values and captions line up across a row even when a long Kyrgyz label wraps.
   Home (data-variant="smart") is Reminders' smart lists: glyph + count on top, name below. */
.kpis {
  --kpi-gap: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--kpi-gap);
  row-gap: 0;
  margin-bottom: calc(var(--space-5) - var(--kpi-gap));
}
.kpi {
  position: relative;
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  row-gap: 0;
  min-width: 0;
  margin-bottom: var(--kpi-gap);
  padding: 14px 16px;
  border-radius: var(--radius-widget);
  background: var(--surface);
  box-shadow:
    0 0 0 0.5px var(--card-ring),
    var(--shadow-sm),
    inset 0 0.5px 0 var(--card-highlight);
  color: var(--text);
  text-decoration: none;
}
.kpi--link {
  -webkit-tap-highlight-color: transparent;
  transition:
    box-shadow var(--dur-2) ease,
    transform var(--dur-snappy) var(--spring-snappy);
}
@media (hover: hover) {
  .kpi--link:hover {
    box-shadow:
      0 0 0 0.5px var(--line),
      var(--shadow-md),
      inset 0 0.5px 0 var(--card-highlight);
  }
}
.kpi--link:active {
  transform: scale(0.97);
  transition-duration: var(--dur-1);
}
.kpi--link:focus-visible {
  outline: 2.5px solid var(--focus-outline);
  outline-offset: 2px;
}
.kpi__label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-bottom: 10px;
  color: var(--text-2);
  font-size: var(--type-subhead);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
}
.kpi__label-text {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
}
/* The glyph: a small round "app icon" in the tile's tone (gray when it carries no news). */
.kpi__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  align-self: flex-start;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--tone-gradient);
  color: var(--tone-on);
  box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.3);
}
.kpi__icon .icon {
  --icon-stroke: 2.4;
  width: 13px;
  height: 13px;
}
/* Color only for meaning: the number turns red for danger (overdue > 0), orange for warning. */
.kpi[data-color="red"]:not([data-variant="smart"]) .kpi__value {
  color: var(--danger-ink);
}
.kpi[data-color="orange"]:not([data-variant="smart"]) .kpi__value {
  color: var(--warning-ink);
}
.kpi__figure {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: end;
  gap: 4px 8px;
  min-width: 0;
}
.kpi__value {
  font-family: var(--font-rounded);
  font-size: var(--fs-large);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.kpi[data-zero] .kpi__value {
  color: var(--text-3);
}
/* Trend chip: ↗ +12% green / ↘ −44% red (Health) */
.kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 22px;
  padding: 0 8px 0 6px;
  border-radius: var(--radius-full);
  font-size: var(--type-footnote);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi__delta--good {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success-ink);
}
.kpi__delta--bad {
  background: color-mix(in srgb, var(--danger) 13%, transparent);
  color: var(--danger-ink);
}
.kpi__delta--flat {
  padding: 0 8px;
  background: var(--fill-1);
  color: var(--text-2);
}
.kpi__caption {
  min-width: 0;
  padding-top: 8px;
  color: var(--text-3);
  font-size: var(--type-caption);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.kpi__caption:empty {
  padding-top: 0;
}
/* Narrow: two tiles a row; the caption is the first thing to go. */
@container (max-width: 559px) {
  .kpi {
    padding: 12px 14px;
  }
  .kpi__caption {
    display: none;
  }
  .kpi__label-text {
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  .kpi__value {
    font-size: var(--fs-title-1);
  }
}
@container (min-width: 640px) {
  .home-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Home: Reminders smart lists — [glyph ····· count] over the list's name. */
.home-kpis {
  --kpi-gap: 12px;
  row-gap: var(--kpi-gap);
  margin-bottom: var(--space-5);
}
.kpi[data-variant="smart"] {
  grid-row: auto;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  grid-template-areas:
    "icon figure"
    "label label";
  align-content: space-between;
  row-gap: 12px;
  min-height: 92px;
  margin: 0;
  padding: 14px;
}
.kpi[data-variant="smart"] .kpi__label {
  display: contents;
}
.kpi[data-variant="smart"] .kpi__icon {
  grid-area: icon;
  width: 30px;
  height: 30px;
}
.kpi[data-variant="smart"] .kpi__icon .icon {
  width: 17px;
  height: 17px;
}
.kpi[data-variant="smart"] .kpi__label-text {
  grid-area: label;
  align-self: end;
  color: var(--text-2);
  font-size: var(--type-body);
  font-weight: var(--fw-semibold);
  line-height: 1.25;
}
.kpi[data-variant="smart"] .kpi__figure {
  grid-area: figure;
  flex-direction: column;
  align-items: flex-end;
  align-self: start;
  gap: 4px;
}
.kpi[data-variant="smart"] .kpi__value {
  font-size: var(--fs-title-1);
}
.kpi[data-variant="smart"] .kpi__delta {
  height: 18px;
  padding: 0 6px 0 4px;
  font-size: var(--type-caption2);
}
.kpi[data-variant="smart"] .kpi__caption {
  display: none;
}
@container (min-width: 900px) {
  .home-kpis {
    --kpi-gap: 16px;
  }
  .kpi[data-variant="smart"] {
    padding: 14px 16px;
  }
}

/* -- Home ----------------------------------------------------------------------------------------
   r4 · 12.1 "Reminders + Widgets": a Calendar-widget date line, a large greeting, the smart lists,
   then cards (radius 22, white on the grey canvas): My work · Projects · Team load | Team pace ·
   Activity. ≥ 1280 (content ≥ 900): 8 / 4 columns; 1024–1279: 7 / 5; narrower: one column. */
.home {
  container-type: inline-size;
}
.home-hero {
  margin: var(--space-1) 0 var(--space-5);
}
.home-hero__date {
  color: var(--accent-ink);
  font-size: var(--type-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.home-hero__title {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: var(--type-large);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.home-hero__subtitle {
  margin-top: var(--space-1);
  color: var(--text-2);
  font-size: var(--type-subhead);
  text-wrap: pretty;
}
@media (min-width: 768px) {
  .home-hero__subtitle {
    font-size: var(--fs-lg);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .home-hero > * {
    animation: home-rise var(--dur-4) var(--ease-out) both;
  }
  .home-hero > :nth-child(2) {
    animation-delay: 40ms;
  }
  .home-hero > :nth-child(3) {
    animation-delay: 90ms;
  }
}
@keyframes home-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.home-grid {
  display: grid;
  gap: 16px;
}
.home-grid__main,
.home-grid__side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
@media (min-width: 1024px) {
  .home-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: start;
  }
}
@media (min-width: 1280px) {
  .home-grid {
    grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  }
}
.home-card {
  container: home-card / inline-size;
  border-radius: var(--radius-widget);
  box-shadow:
    0 0 0 0.5px var(--card-ring),
    var(--shadow-sm),
    inset 0 0.5px 0 var(--card-highlight);
}
.home-card__header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  margin-bottom: var(--space-3);
}
.card--flush > .home-card__header {
  margin: 0;
  padding: 16px 16px 8px;
}
.home-card__titles {
  flex: 1;
  min-width: 0;
}
.home-card__title {
  font-size: var(--type-title3);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  letter-spacing: var(--tracking-snug);
  overflow-wrap: break-word;
}
.home-card__subtitle {
  margin-top: 1px;
  color: var(--text-3);
  font-size: var(--type-footnote);
  line-height: 1.35;
  text-wrap: pretty;
}
.home-card__more {
  margin-top: 2px;
}
/* "View all ›": core .more-link (content.css). */

/* My work: a Reminders list — colored section names, round checks, hairlines from the text. */
.home-work__group {
  padding-bottom: 4px;
}
.home-work__label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 4px;
  color: var(--text-2);
  font-size: var(--type-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.home-work__group[data-group="overdue"] .home-work__label {
  color: var(--danger-ink);
}
.home-work__group[data-group="today"] .home-work__label {
  color: var(--warning-ink);
}
.home-work__signal {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}
.home-work__list {
  padding-bottom: 6px;
}
/* Every row is the viewer's own task: the assignee avatar and labels are noise here. */
.home-work .task-row__labels,
.home-work .task-row__cell--assignee,
.home-work .task-row__meta > .avatar {
  display: none;
}
.home-work .project-chip {
  max-width: 170px;
}
/* A narrow card (laptops, the two-column home): the title keeps its room — the project shows as
   its tile (name in the tooltip). */
@media (min-width: 768px) {
  @container task-row (max-width: 600px) {
    .home-work .task-row__project .project-chip {
      width: 22px;
      padding: 0;
      justify-content: center;
    }
    .home-work .task-row__project .project-chip .chip__text {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
  }
}
.home-work .empty-state {
  padding-block: var(--space-8);
}
@media (max-width: 767px) {
  /* no assignee avatar on the right: give the title that room back */
  .home-work .task-row {
    padding-right: 14px;
  }
}

/* Projects: tiles — squircle · name ★ · facts · Activity ring. A grid of 2–3 on wide cards; on
   phones a scroll-snap carousel (cards 72vw, like the Reminders list widgets). */
.home-projects .home-projects__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 10px;
  margin: 0;
  padding: 4px 16px 16px;
  list-style: none;
}
.home-projects__cell {
  min-width: 0;
}
.home-project {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  height: 100%;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-card);
  background: var(--fill-1);
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-1) ease,
    transform var(--dur-snappy) var(--spring-snappy);
}
@media (hover: hover) {
  .home-project:hover {
    background: var(--fill-2);
  }
}
.home-project:active {
  transform: scale(0.97);
  transition-duration: var(--dur-1);
}
.home-project:focus-visible {
  outline: 2.5px solid var(--focus-outline);
  outline-offset: 2px;
}
.home-project__tile {
  --size: 36px;
}
.home-project__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.home-project__name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: var(--type-body);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
}
.home-project__star {
  flex-shrink: 0;
  color: var(--c-yellow);
}
.home-project__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
  min-width: 0;
  color: var(--text-2);
  font-size: var(--type-footnote);
  white-space: nowrap;
}
.home-project__overdue {
  color: var(--danger-ink);
  font-weight: var(--fw-medium);
}
.home-project__progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.home-project__pct {
  color: var(--text-2);
  font-size: var(--type-caption2);
  font-weight: var(--fw-semibold);
  line-height: 1;
}
@media (max-width: 767px) {
  .home-projects {
    overflow: hidden;
  }
  .home-projects .home-projects__list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 4px 16px 16px;
    scroll-padding-inline: 16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .home-projects__list::-webkit-scrollbar {
    display: none;
  }
  .home-projects__cell {
    flex: 0 0 72vw;
    max-width: 300px;
    scroll-snap-align: start;
  }
  .home-project {
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-areas:
      "tile ring"
      "body body";
    align-items: start;
    gap: 10px;
    min-height: 112px;
    padding: 14px;
  }
  .home-project__tile {
    grid-area: tile;
  }
  .home-project__body {
    grid-area: body;
    align-self: end;
  }
  .home-project__progress {
    grid-area: ring;
    flex-direction: row;
    justify-self: end;
    gap: 6px;
  }
}

/* Team pace (Fitness): a big number + trend chip, then 14 rounded day bars — today strong. */
.home-momentum {
  --bar: var(--chart-muted);
  --bar-strong: var(--chart-strong);
}
.momentum__figure {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 14px;
}
.momentum__total {
  font-family: var(--font-rounded);
  font-size: var(--fs-large);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.home-momentum .kpi__delta--bad,
.home-momentum .kpi__delta--good {
  background: var(--fill-1);
}
.momentum__vs {
  flex-basis: 100%;
  color: var(--text-3);
  font-size: var(--type-caption);
}
.momentum__chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 84px;
  padding-top: 6px;
}
/* Daily average: a dashed reference line behind the bars */
.momentum__avg {
  position: absolute;
  right: 0;
  bottom: calc(var(--value) * (100% - 6px) / 100);
  left: 0;
  height: 0;
  border-top: 1px dashed color-mix(in srgb, var(--text-3) 55%, transparent);
  pointer-events: none;
}
.momentum__bar {
  position: relative;
  display: flex;
  flex: 1 1 0;
  align-items: flex-end;
  height: 100%;
  min-width: 0;
  cursor: default;
}
.momentum__fill {
  width: 100%;
  max-width: 18px;
  height: max(6px, calc(var(--value) * 1%));
  margin: 0 auto;
  border-radius: 4px;
  background: var(--bar);
  transform-origin: bottom;
  transition:
    background-color var(--dur-1) ease,
    opacity var(--dur-1) ease;
}
.momentum__bar.is-zero .momentum__fill {
  height: 6px;
  border-radius: 3px;
  background: var(--chart-track);
}
.momentum__bar.is-today .momentum__fill {
  background: var(--bar-strong);
}
/* Health-style focus: hovering one day dims the others. */
@media (hover: hover) {
  .momentum__chart:hover .momentum__bar:not(:hover) .momentum__fill {
    opacity: 0.4;
  }
  .momentum__bar:hover .momentum__fill {
    background: var(--bar-strong);
  }
}
.momentum__axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--chart-axis);
  font-size: var(--type-caption2);
}
@media (prefers-reduced-motion: no-preference) {
  .momentum__fill {
    animation: insights-grow-y var(--dur-smooth) var(--spring-smooth) both;
    animation-delay: calc(var(--i, 0) * var(--stagger, 28ms) + 120ms);
  }
  .momentum__avg {
    animation: insights-fade 600ms ease 700ms both;
  }
}
@keyframes insights-grow-y {
  from {
    transform: scaleY(0);
  }
}
@keyframes insights-grow-x {
  from {
    transform: scaleX(0);
  }
}
@keyframes insights-fade {
  from {
    opacity: 0;
  }
}

/* Team load (Screen Time): avatar · name · a rounded bar · count */
.load-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.load-list__row {
  display: grid;
  grid-template-columns: 24px minmax(0, 7.5rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.load-list__name {
  overflow: hidden;
  font-size: var(--type-subhead);
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.load-list__bar {
  height: 10px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--chart-track);
}
.load-list__bar > span {
  display: block;
  width: calc(var(--value) * 1%);
  min-width: 10px;
  height: 100%;
  border-radius: inherit;
  background: var(--chart-strong);
  transform-origin: left;
}
@media (prefers-reduced-motion: no-preference) {
  .load-list__bar > span {
    animation: insights-grow-x var(--dur-smooth) var(--spring-smooth) both;
    animation-delay: calc(var(--i, 0) * var(--stagger, 28ms) * 2 + 150ms);
  }
}
.load-list__value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 3.25rem;
  font-family: var(--font-rounded);
  font-size: var(--type-subhead);
  font-weight: var(--fw-semibold);
}
.load-list__empty {
  color: var(--text-2);
  font-size: var(--type-subhead);
}
.home-activity__list .activity-day + .activity-day {
  margin-top: var(--space-3);
}
.home-activity__list .activity-day__label {
  color: var(--text-2);
  font-size: var(--type-caption);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Getting started (iOS "Setup" list): ring + three steps, done ones get a green check. */
.home-setup {
  display: grid;
  gap: 16px;
  margin-bottom: var(--space-5);
  border-radius: var(--radius-widget);
  background:
    radial-gradient(120% 140% at 0% 0%, var(--accent-softer), transparent 55%),
    var(--surface);
}
@container (min-width: 720px) {
  .home-setup {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    align-items: center;
    gap: 24px;
  }
}
.home-setup__intro {
  display: flex;
  align-items: center;
  gap: 14px;
}
.home-setup__title {
  font-size: var(--type-title3);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-snug);
}
.home-setup__text {
  color: var(--text-2);
  font-size: var(--type-subhead);
}
.home-setup__steps {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 0 0 0.5px var(--card-ring);
  list-style: none;
}
.home-setup__step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 12px 6px 14px;
}
.home-setup__step + .home-setup__step::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 48px;
  height: 0.5px;
  background: var(--line);
}
.home-setup__check {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: transparent;
}
.home-setup__step.is-done .home-setup__check {
  background: var(--success);
  box-shadow: none;
  color: var(--text-on-accent);
}
.home-setup__label {
  flex: 1;
  min-width: 0;
  font-weight: var(--fw-medium);
}
.home-setup__step.is-done .home-setup__label {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

/* A brand-new workspace: one calm card with the ways to start (components/empty_state.html steps) */
.home-start.home-setup {
  display: block;
  margin-bottom: var(--space-5);
  padding: var(--space-6) var(--space-4);
  background: var(--surface);
}
.home-start .empty-state {
  padding-block: var(--space-4);
}
@media (max-width: 639px) {
  .home-start.home-setup {
    padding: var(--space-3) var(--space-1);
  }
}
/* No keyboard: the "press C" tip means nothing */
@media (hover: none) and (pointer: coarse) {
  .home-start .empty-state__hint {
    display: none;
  }
}
.home--fresh .home-projects {
  max-width: 760px;
  margin-inline: auto;
}

/* -- Search -------------------------------------------------------------------------------------- */
.search-page__form {
  margin-bottom: var(--space-5);
}
.search-page__field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-control, 10px);
  background: var(--fill-1);
  color: var(--text-3);
  transition:
    background-color var(--dur-1) ease,
    box-shadow var(--dur-1) ease;
}
/* r4 · 12.4: an iOS search field — a filled capsule, accent ring on focus */
.search-page__field:focus-within {
  background: var(--surface);
  box-shadow:
    0 0 0 0.5px var(--card-ring),
    0 0 0 3.5px var(--focus-ring);
}
.search-page__field > .icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}
.search-page__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-xl);
  outline: none;
}
.search-page__input::placeholder {
  color: var(--text-3);
}
.search-tabs.tabs {
  margin-bottom: var(--space-5);
}
.search-section + .search-section {
  margin-top: var(--space-6);
}
.search-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: var(--space-2);
  padding-left: 4px;
}
.search-section__title {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.search-list {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--card-ring),
    var(--shadow-xs);
}
.search-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 16px;
  color: inherit;
  transition: background-color var(--dur-1) ease;
}
.search-item + .search-item::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 60px;
  height: 1px;
  background: var(--line);
}
.search-item:hover,
.search-item.is-active {
  background: var(--fill-1);
}
.search-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}
.search-item__icon--task {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--text-3);
}
.search-item__icon--task.is-done {
  color: var(--success);
}
.search-item__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.search-item__title {
  overflow: hidden;
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-item__title .task-key {
  margin-right: 4px;
}
.search-item__sub {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.search-item__sep {
  color: var(--text-3);
}
.search-item__trail {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}
.palette mark {
  padding: 0 1px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--c-yellow) 38%, transparent);
  color: inherit;
}
/* r4 · 12.4: the query in results reads as an accent highlight (not a yellow marker) */
.search-page mark {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.search-tabs .tab.is-empty {
  color: var(--text-3);
}
.search-tabs .tab.is-empty .badge {
  opacity: 0.6;
}
@media (max-width: 639px) {
  .search-item__trail .due,
  .search-item__trail .status-pill {
    display: none;
  }
  .search-item__title {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .search-page__input {
    font-size: max(16px, var(--fs-lg));
  }
}

/* -- Command palette ------------------------------------------------------------------------------ */
html:has(.palette[open]) {
  overflow: hidden;
}
.palette {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: clamp(16px, 11vh, 120px) 16px 16px;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--text);
}
.palette::backdrop {
  background: light-dark(rgb(0 0 0 / 0.18), rgb(0 0 0 / 0.5));
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 1;
  transition: opacity var(--dur-2) var(--ease-out);
}
.palette__panel {
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  max-height: min(600px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: saturate(180%) blur(32px);
  backdrop-filter: saturate(180%) blur(32px);
  box-shadow:
    0 0 0 1px var(--glass-line),
    var(--shadow-xl);
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-3) var(--ease-spring);
}
@starting-style {
  .palette[open] .palette__panel {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  .palette[open]::backdrop {
    opacity: 0;
  }
}
.palette.is-closing .palette__panel {
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition:
    opacity var(--dur-1) ease,
    transform var(--dur-2) var(--ease-out);
}
.palette.is-closing::backdrop {
  opacity: 0;
}
.palette__search {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--line);
}
.palette__search-icon {
  flex-shrink: 0;
  color: var(--text-3);
}
.palette__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-xl);
  outline: none;
}
.palette__input::placeholder {
  color: var(--text-3);
}
.palette__busy {
  display: inline-flex;
  opacity: 0;
  transition: opacity var(--dur-2) ease;
}
.palette.is-busy .palette__busy {
  opacity: 1;
  transition-delay: 160ms;
}
.palette__close {
  flex-shrink: 0;
  padding: 4px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: var(--fs-md);
  cursor: pointer;
}
.palette__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.palette__close-text {
  display: none;
}
.palette__main {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}
.palette__list {
  min-height: 0;
  padding: 6px 8px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding: 8px;
}
.palette__results {
  transition: opacity var(--dur-1) ease;
}
.palette.is-busy .palette__results {
  opacity: 0.6;
}
.palette__section + .palette__section,
.palette__recent + .palette__results > .palette__section:first-child {
  margin-top: 6px;
}
.palette__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 4px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.palette__label-action {
  padding: 2px 6px;
  margin: -2px -6px;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--text-3);
  font: inherit;
  font-weight: var(--fw-medium);
  cursor: pointer;
}
.palette__label-action:hover {
  background: var(--fill-1);
  color: var(--text);
}
.palette__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  color: var(--text);
  scroll-margin: 8px;
  cursor: pointer;
  user-select: none;
}
.palette__item.is-active {
  background: var(--fill-2);
}
.palette__item.is-active::after {
  content: "\21B5";
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 22px;
  height: 20px;
  border-radius: 5px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--text-2);
  font-size: var(--fs-2xs);
}
.palette__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--fill-1);
  color: var(--text-2);
}
.palette__item.is-active .palette__icon:not(.palette__icon--task) {
  background: var(--surface);
  color: var(--text);
}
.palette__icon--task {
  background: none;
  color: var(--text-3);
}
.palette__icon--task.is-done {
  color: var(--success);
}
.palette__item .avatar,
.palette__item .icon-tile,
.palette__item .ws-tile {
  flex-shrink: 0;
}
.palette__item > .avatar--sm,
.palette__item > .icon-tile--sm {
  margin-inline: 2px;
}
.palette__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.palette__title {
  overflow: hidden;
  font-size: var(--fs-md);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette__title .task-key {
  margin-right: 4px;
}
.palette__sub {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette__meta,
.palette__kbd {
  flex-shrink: 0;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.palette__kbd .kbd-combo {
  display: inline-flex;
  gap: 3px;
}
/* "G then H": the keys say it — "then" stays for screen readers only. */
.palette__kbd .kbd-combo__then {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.palette__item.is-active .palette__kbd,
.palette__item.is-active .palette__meta {
  display: none;
}
@media (hover: none) {
  .palette__kbd,
  .palette__item.is-active::after {
    display: none;
  }
}
.palette__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 16px 18px;
  text-align: center;
}
.palette__empty-art {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: var(--fill-1);
  color: var(--text-3);
}
.palette__empty-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  overflow-wrap: anywhere;
}
.palette__empty-text {
  max-width: 340px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
@media (prefers-reduced-motion: no-preference) {
  .palette__empty-art {
    animation: palette-wobble 700ms var(--ease-out) both;
  }
}
@keyframes palette-wobble {
  0% { transform: scale(0.8) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.04) rotate(3deg); opacity: 1; }
}

/* Preview pane (≥ 1100px): what the active result is, before you open it */
.palette__preview {
  display: none;
}
@media (min-width: 1100px) and (hover: hover) {
  .palette__panel {
    width: min(900px, 100%);
  }
  .palette__main {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
  .palette__preview {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    border-left: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 55%, transparent);
  }
}
.palette__preview.is-fresh > * {
  animation: palette-preview-in var(--dur-2) var(--ease-out) both;
}
@keyframes palette-preview-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
.palette__preview-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
}
.palette__preview-art {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--fill-1);
}
.pv {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.pv--center {
  align-items: center;
  margin-block: auto;
  padding-top: 12px;
  text-align: center;
}
.pv__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.pv__eyebrow {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.pv__title {
  font-family: var(--font-display);
  font-size: var(--fs-title-3);
  font-weight: var(--fw-bold);
  line-height: 1.2;
  letter-spacing: var(--tracking-snug);
  overflow-wrap: anywhere;
}
.pv__eyebrow + .pv__title {
  margin-top: -6px;
}
.pv__hero {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pv__hero-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pv__hero .pv__title {
  font-size: var(--fs-xl);
}
.pv__progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--fill-1);
}
.pv__big {
  font-weight: var(--fw-semibold);
}
.pv__muted {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.pv__danger {
  color: var(--danger-ink);
}
.pv__mail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.pv__props {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}
.pv__props > div {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  align-items: center;
  gap: 10px;
  min-height: 24px;
}
.pv__props dt {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.pv__props dd {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  font-size: var(--fs-sm);
}
.pv__text {
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.pv--command .pv__title {
  font-size: var(--fs-lg);
}
.pv__command-art .palette__icon,
.pv__command-art .icon-tile,
.pv__command-art .ws-tile {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}
.pv__command-art .icon {
  width: 24px;
  height: 24px;
}
.pv__kbd {
  display: inline-flex;
  gap: 4px;
  margin-top: 4px;
}
.pv__kbd .kbd-combo {
  display: inline-flex;
  gap: 4px;
}
.pv__kbd .kbd-combo__then {
  color: var(--text-3);
  font-size: var(--fs-xs);
}

.palette__footer {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 18px;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.palette__footer span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.palette__footer kbd {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
}
.palette__footer-end {
  margin-left: auto;
}
@media (max-width: 899px) {
  .palette__footer-newtab {
    display: none;
  }
}
@media (pointer: coarse), (max-width: 639px) {
  .palette__footer {
    display: none;
  }
  .palette__input {
    font-size: max(16px, var(--fs-xl));
  }
}
/* Phones: full-screen sheet */
@media (max-width: 639px) {
  .palette {
    padding: 0;
  }
  .palette__panel {
    width: 100%;
    height: 100%;
    max-height: none;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    border-radius: 0;
    background: var(--surface-elevated);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }
  @starting-style {
    .palette[open] .palette__panel {
      opacity: 0;
      transform: translateY(24px);
    }
  }
  .palette.is-closing .palette__panel {
    transform: translateY(24px);
  }
  .palette__search {
    height: 56px;
    padding: 0 12px 0 16px;
  }
  .palette__item {
    min-height: 48px;
  }
}
/* No keyboard: "Cancel" instead of the Esc key */
@media (hover: none), (max-width: 639px) {
  .palette__close-key {
    display: none;
  }
  .palette__close-text {
    display: inline;
  }
}

/* -- Insights ------------------------------------------------------------------------------------ */
.insights-body {
  container-type: inline-size;
}
.insights-content {
  transition: opacity var(--dur-2) ease;
}
/* Filter change in flight: the report dims and every chart card shimmers. */
.insights-body:has(.filter-bar.htmx-request) .insights-content {
  opacity: 0.6;
}
.insights-body:has(.filter-bar.htmx-request) .chart-card,
.insights-body:has(.filter-bar.htmx-request) .kpi {
  position: relative;
  overflow: hidden;
}
.insights-body:has(.filter-bar.htmx-request) .chart-card::after,
.insights-body:has(.filter-bar.htmx-request) .kpi::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--surface) 70%, transparent) 50%, transparent 80%);
  background-size: 200% 100%;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .insights-body:has(.filter-bar.htmx-request) .chart-card::after,
  .insights-body:has(.filter-bar.htmx-request) .kpi::after {
    animation: insights-shimmer 1.1s ease-in-out infinite;
  }
}
@keyframes insights-shimmer {
  from {
    background-position: 150% 0;
  }
  to {
    background-position: -50% 0;
  }
}

/* KPI row: 2 → 3 + 2 → 5 across */
.insights-kpis > :last-child {
  grid-column: 1 / -1;
}
@container (min-width: 600px) {
  .insights-kpis {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .insights-kpis > * {
    grid-column: span 2;
  }
  .insights-kpis > :nth-child(n + 4) {
    grid-column: span 3;
  }
}
@container (min-width: 960px) {
  .insights-kpis {
    --kpi-gap: 16px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .insights-kpis > *,
  .insights-kpis > :nth-child(n + 4) {
    grid-column: auto;
  }
}

.insights-grid {
  display: grid;
  grid-auto-flow: row dense;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
@container (min-width: 760px) {
  .insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .insights-grid__throughput,
  .insights-grid__stages,
  .insights-grid__overdue,
  .insights-grid__health {
    grid-column: 1 / -1;
  }
}
@container (min-width: 1080px) {
  .insights-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
  .insights-grid__throughput,
  .insights-grid__stages {
    grid-column: span 2;
  }
  .insights-grid__overdue {
    grid-column: auto;
  }
}
/* No data at all: one empty state instead of the charts */
.insights-empty {
  padding: var(--space-8) var(--space-4);
}
.chart-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
}
.chart-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: var(--space-4);
}
.chart-card__header .chart-legend {
  margin: 2px 0 0;
}
.chart-card__heading {
  min-width: 0;
}
.chart-card__header--padded {
  margin: 0;
  padding: 16px 20px 12px;
}
.chart-card__title {
  font-size: var(--type-title3);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  letter-spacing: var(--tracking-snug);
  overflow-wrap: anywhere;
}
.chart-card__subtitle {
  margin-top: 2px;
  color: var(--text-3);
  font-size: var(--type-footnote);
  line-height: 1.35;
  text-wrap: pretty;
}
.chart-card__canvas {
  position: relative;
  height: var(--chart-h, 240px);
  min-width: 0;
}
.chart-card__canvas canvas {
  position: absolute;
  inset: 0;
}
.chart-data {
  margin-top: var(--space-3);
}
.chart-data > summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  margin-left: -6px;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  list-style: none;
  cursor: pointer;
}
.chart-data > summary::-webkit-details-marker {
  display: none;
}
.chart-data > summary::before {
  content: "";
  width: 10px;
  height: 10px;
  background: currentColor;
  -webkit-mask: var(--chevron-mask) center / contain no-repeat;
  mask: var(--chevron-mask) center / contain no-repeat;
  transition: transform var(--dur-2) var(--ease-out);
}
.chart-data[open] > summary::before {
  transform: rotate(90deg);
}
.chart-data > summary:hover {
  background: var(--fill-1);
  color: var(--text);
}
.chart-data > summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.chart-data[open] > summary {
  margin-bottom: var(--space-2);
}
.chart-data .table-wrap {
  max-height: 280px;
  overflow: auto;
  box-shadow: 0 0 0 1px var(--line);
}
.chart-data .table td,
.chart-data .table th {
  height: 34px;
}
@media (prefers-reduced-motion: no-preference) {
  .chart-data[open] .table-wrap {
    animation: insights-drop-in var(--dur-2) var(--ease-out) both;
  }
}
@keyframes insights-drop-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* Chart tooltip (Chart.js external tooltip, static/js/insights.js) — r4: a thick glass card */
.chart-tip {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  min-width: 132px;
  padding: 8px 10px;
  border: 0.5px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-sheen), var(--mat-thick);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  box-shadow: var(--glass-rim), var(--shadow-lg);
  color: var(--text);
  font-size: var(--type-caption);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--dur-1) ease,
    transform var(--dur-2) var(--ease-out);
}
.chart-tip.is-visible {
  opacity: 1;
}
.chart-tip__title {
  margin-bottom: 6px;
  color: var(--text-2);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.chart-tip__row {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.chart-tip__row + .chart-tip__row {
  margin-top: 4px;
}
.chart-tip__swatch {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.chart-tip__label {
  flex: 1;
  color: var(--text-2);
}
.chart-tip__value {
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

/* Doughnut + legend: side by side when the card is wide enough, else stacked */
.chart-card--split {
  container-type: inline-size;
}
.split {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.split__chart {
  position: relative;
  flex-shrink: 0;
  width: 172px;
  height: 172px;
}
.split__chart canvas {
  position: absolute;
  inset: 0;
}
.split__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.split__total {
  font-family: var(--font-rounded);
  font-size: var(--fs-large);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.split__caption {
  margin-top: 3px;
  color: var(--text-3);
  font-size: var(--type-caption2);
}
.split__legend {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.split__row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 3rem;
  font-variant-numeric: tabular-nums;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  transition:
    background-color var(--dur-1) ease,
    opacity var(--dur-1) ease;
}
.split__row:hover,
.split__row.is-hot {
  background: var(--fill-1);
}
.split__row.is-empty {
  opacity: 0.5;
}
.split__label {
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.split__value {
  font-weight: var(--fw-semibold);
  text-align: right;
}
.split__pct {
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-align: right;
}
@container (min-width: 440px) {
  .split {
    flex-direction: row;
    gap: 22px;
  }
  .split__legend {
    flex: 1;
  }
}

/* Open work by stage: one stacked bar per project, scaled to the busiest */
.stage-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stage-row__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 6px;
  color: inherit;
}
.stage-row__name {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
a.stage-row__head:hover .stage-row__name {
  color: var(--accent-ink);
}
a.stage-row__head:focus-visible {
  outline: none;
  border-radius: var(--radius-xs);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.stage-row__nums {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.stage-row__num {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.stage-row__num .chart-legend__swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
/* r4 · 12.16: 8 px stacked bars, every segment a rounded capsule with a 2 px gap */
.stage-row__track {
  display: block;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--chart-track, var(--fill-1));
}
.stage-row__bar {
  display: flex;
  gap: 2px;
  width: calc(var(--total) / var(--peak) * 100%);
  min-width: 8px;
  height: 100%;
  border-radius: inherit;
  transform-origin: left;
}
.stage-row__seg {
  min-width: 8px;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--swatch);
  transition: opacity var(--dur-1) ease;
}
@media (hover: hover) {
  .stage-list:hover .stage-row:not(:hover) .stage-row__seg {
    opacity: 0.4;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .stage-row__bar {
    animation: insights-grow-x var(--dur-4) var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * var(--stagger, 28ms) * 2 + 120ms);
  }
}

/* Ranked bar list (one series → one color) */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bar-list__row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 0 10px;
}
.bar-list__bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--value) * 1%);
  min-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  transform-origin: left;
  transition: opacity var(--dur-1) ease;
}
@media (hover: hover) {
  .bar-list:hover .bar-list__row:not(:hover) .bar-list__bar {
    opacity: 0.45;
  }
}
.bar-list--danger .bar-list__bar {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .bar-list__bar {
    animation: insights-grow-x var(--dur-4) var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * var(--stagger, 28ms) * 2 + 120ms);
  }
}
.bar-list__label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
a.bar-list__label:hover {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 2px;
}
.bar-list__value {
  position: relative;
  flex-shrink: 0;
  color: var(--text);
  font-family: var(--font-rounded);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

/* Projects health: a table; cards on phones */
.insights-health {
  overflow-x: auto;
}
.insights-health .table {
  min-width: 760px;
}
.insights-health .table tbody th {
  padding-left: 20px;
  font-weight: var(--fw-regular);
  text-align: left;
}
.health-project {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
}
.health-project:hover .health-project__name {
  color: var(--accent-ink);
}
.health-project__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.health-project__name {
  overflow: hidden;
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--dur-1) ease;
}
.health-project__team {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.health-progress {
  min-width: 112px;
}
/* Wide screens must never scroll the table: long names ellipsize instead. */
.insights-health .health-project {
  max-width: 260px;
}
.health-table__lead .user-chip,
.health-table__lead > * {
  max-width: 180px;
}
.health-table td,
.health-table th {
  white-space: nowrap;
}
.health-overdue {
  color: var(--danger-ink);
  font-weight: var(--fw-semibold);
}
@container (max-width: 639px) {
  .insights-health {
    overflow: visible;
  }
  .insights-health .table {
    min-width: 0;
  }
  .health-table,
  .health-table tbody {
    display: block;
  }
  .health-table thead {
    display: none;
  }
  .health-table tr {
    display: grid;
    grid-template-areas:
      "project project"
      "status progress"
      "open overdue"
      "lead due";
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: 10px 14px;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
  }
  .health-table tr > :nth-child(1) { grid-area: project; }
  .health-table tr > :nth-child(2) { grid-area: status; }
  .health-table tr > :nth-child(3) { grid-area: progress; }
  .health-table tr > :nth-child(4) { grid-area: open; }
  .health-table tr > :nth-child(5) { grid-area: overdue; }
  .health-table tr > :nth-child(6) { grid-area: lead; }
  .health-table tr > :nth-child(7) { grid-area: due; }
  .health-table tr > * {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    height: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
  }
  .health-table tr > [data-label]::before {
    content: attr(data-label);
    color: var(--text-3);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-medium);
  }
  .insights-health .table tbody th.health-table__project {
    grid-column: 1 / -1;
    padding: 0;
  }
  .health-table__progress .health-progress {
    width: 100%;
    min-width: 0;
  }
  .health-project__name {
    white-space: normal;
  }
}

/* -- Workload ------------------------------------------------------------------------------------ */
.workload-body {
  container-type: inline-size;
}
@container (min-width: 640px) {
  .workload-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@container (min-width: 900px) {
  .workload-kpis {
    --kpi-gap: 16px;
  }
}
/* r4 · 12.16 Screen Time: "Average 7.4 open tasks per person" + the average-load key */
.wl-average {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 0 var(--space-4);
  padding: 16px 18px;
  border-radius: var(--radius-widget);
  background: var(--surface);
  box-shadow:
    0 0 0 0.5px var(--card-ring),
    var(--shadow-sm),
    inset 0 0.5px 0 var(--card-highlight);
}
.wl-average__figure {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.wl-average__label {
  color: var(--text-2);
  font-size: var(--type-subhead);
  font-weight: var(--fw-semibold);
}
.wl-average__value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}
.wl-average__number {
  font-family: var(--font-rounded);
  font-size: var(--fs-large);
  font-weight: var(--fw-bold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.wl-average__unit {
  color: var(--text-2);
  font-size: var(--type-body);
  font-weight: var(--fw-medium);
}
.wl-average__load {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-2);
  font-size: var(--type-footnote);
  font-variant-numeric: tabular-nums;
}
.wl-average__tick {
  width: 0;
  height: 16px;
  border-left: 1.5px dashed var(--text-3);
}
.workload-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0 0 var(--space-3) 2px;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.workload-note__text .icon {
  margin-right: 6px;
  vertical-align: -2px;
}
.workload-note__legend {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-left: auto;
}
.wl-key {
  width: 10px;
  height: 8px;
  margin-left: 6px;
  border-radius: var(--radius-full);
  background: var(--load-color);
}
.wl-key--calm { --load-color: var(--chart-strong); }
.wl-key--busy { --load-color: var(--warning); }
.wl-key--over { --load-color: var(--danger); }

.wl-table {
  --wl-cols: minmax(200px, 2.2fr) repeat(5, minmax(60px, 0.7fr)) minmax(200px, 1.9fr) 28px;
  overflow: clip;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow:
    0 0 0 0.5px var(--card-ring),
    var(--shadow-xs);
}
.wl-head,
.wl-row__main {
  display: grid;
  grid-template-columns: var(--wl-cols);
  align-items: center;
  gap: 0 14px;
  padding: 0 14px 0 20px;
}
/* No open work yet: one quiet line above the (all-zero) table */
.workload-empty {
  margin-bottom: var(--space-4);
}
/* The header stays in view while the list scrolls under the top bar. */
.wl-head {
  position: sticky;
  z-index: 2;
  top: calc(var(--topbar-h) + var(--safe-top, 0px));
  min-height: 40px;
  border-bottom: 0.5px solid var(--line);
  background: var(--mat-chrome);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.wl-sort {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: -4px -6px;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  color: inherit;
  transition:
    color var(--dur-1) ease,
    background-color var(--dur-1) ease;
}
.wl-sort:hover {
  background: var(--fill-1);
  color: var(--text);
}
.wl-sort.is-active {
  color: var(--accent-ink);
}
.wl-sort:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.wl-col--open,
.wl-col--overdue,
.wl-col--due_week,
.wl-col--done,
.wl-col--logged {
  justify-self: end;
  text-align: right;
}
.wl-row {
  position: relative;
}
.wl-row + .wl-row::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  left: 64px;
  height: 0.5px;
  background: var(--line);
}
.wl-row__main {
  position: relative;
  width: 100%;
  min-height: 64px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-1) ease;
}
.wl-row__main:hover,
.wl-row.is-open .wl-row__main {
  background: var(--fill-1);
}
.wl-row__main:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}
/* Over capacity (r4 · 12.16): the row is tinted with the warning color */
.wl-row.is-over {
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}
.wl-col--person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.wl-person {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wl-person__name,
.wl-person__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wl-person__name {
  font-weight: var(--fw-semibold);
}
.wl-person__title {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.wl-num {
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
}
.wl-num.is-danger {
  color: var(--danger-ink);
  font-weight: var(--fw-semibold);
}
.wl-num.is-success {
  color: var(--text);
}
.wl-row {
  --load-color: var(--chart-strong);
}
.wl-row.is-busy {
  --load-color: var(--warning);
}
.wl-row.is-over {
  --load-color: var(--danger);
}

/* Load bar: 0 … --scale % of capacity; the tick is 100 %; past it the bar is striped. */
.wl-load {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.wl-load__track {
  position: relative;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--chart-track, var(--fill-2));
}
.wl-load__fill,
.wl-load__over {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: inherit;
  transform-origin: left;
}
.wl-load__fill {
  width: calc(min(var(--load), 100) / var(--scale) * 100%);
  min-width: 4px;
  background: var(--load-color);
}
.wl-load__over {
  display: none;
  left: calc(100 / var(--scale) * 100% + 1px);
  width: calc((min(var(--load), var(--scale)) - 100) / var(--scale) * 100% - 1px);
  background: repeating-linear-gradient(
    -45deg,
    var(--danger) 0 4px,
    color-mix(in srgb, var(--danger) 55%, var(--surface)) 4px 7px
  );
}
.wl-row.is-over .wl-load__over {
  display: block;
}
.wl-row.is-over .wl-load__fill {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.wl-load__cap {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: calc(100 / var(--scale) * 100%);
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--text-3);
  opacity: 0.55;
}
.wl-table:not(.has-overload) .wl-load__cap {
  display: none;
}
/* The team average: a dashed tick on every bar — together they read as one vertical line. */
.wl-load__avg {
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: calc(var(--avg, 0) / var(--scale) * 100%);
  width: 0;
  border-left: 1.5px dashed var(--text-2);
  opacity: 0.7;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .wl-load__fill {
    animation: insights-grow-x var(--dur-4) var(--ease-out) 100ms both;
  }
  .wl-load__over {
    animation: insights-fade var(--dur-3) ease 420ms both;
  }
}
.wl-load__text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.wl-load__pct {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text);
  font-weight: var(--fw-semibold);
}
.wl-load__pct .icon {
  align-self: center;
}
.wl-row.is-busy .wl-load__pct {
  color: var(--warning-ink);
}
.wl-row.is-over .wl-load__pct {
  color: var(--danger-ink);
}
.wl-load__hours {
  white-space: nowrap;
}
.wl-load__hint {
  margin-left: auto;
  color: var(--text-3);
  white-space: nowrap;
}
.wl-row__chevron {
  color: var(--text-3);
  transition: transform var(--dur-3) var(--ease-spring-soft, var(--ease-out));
}
.wl-row.is-open .wl-row__chevron {
  transform: rotate(180deg);
}

/* Expanded: the person's open tasks */
/* r4: an inset grouped list on the sunken canvas */
.wl-row__tasks {
  border-top: 0.5px solid var(--line);
  background: var(--bg);
}
.wl-row .wl-tasks {
  margin: 10px 14px 12px 64px;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 0 0 0.5px var(--card-ring);
  list-style: none;
}
.wl-tasks > li {
  position: relative;
}
.wl-tasks > li + li::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 36px;
  height: 0.5px;
  background: var(--line);
}
.wl-task {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  color: inherit;
  transition: background-color var(--dur-1) ease;
}
.wl-task:hover {
  background: var(--fill-1);
}
.wl-task:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}
.wl-task__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wl-task__meta {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: var(--fs-xs);
}
.wl-task__project {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 160px;
}
.wl-tasks__empty {
  padding: 14px 20px 14px 64px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.wl-tasks__loading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 18px 74px;
}
.wl-tasks__loading .skeleton:nth-child(2) {
  width: 82%;
}
.wl-tasks__loading .skeleton:nth-child(3) {
  width: 64%;
}
@media (prefers-reduced-motion: no-preference) {
  .wl-tasks > li {
    animation: insights-drop-in var(--dur-2) var(--ease-out) both;
  }
  .wl-tasks > li:nth-child(2) { animation-delay: 20ms; }
  .wl-tasks > li:nth-child(3) { animation-delay: 40ms; }
  .wl-tasks > li:nth-child(4) { animation-delay: 60ms; }
  .wl-tasks > li:nth-child(n + 5) { animation-delay: 80ms; }
}
@container (max-width: 1099px) {
  .wl-table {
    --wl-cols: minmax(170px, 2fr) repeat(5, minmax(48px, 0.6fr)) minmax(170px, 1.7fr) 24px;
  }
  .wl-task__project,
  .wl-task__meta .chip {
    display: none;
  }
}
/* Narrow: each person becomes a card (labels from data-label) */
@container (max-width: 859px) {
  .wl-head {
    display: none;
  }
  .wl-row__main {
    grid-template-columns: repeat(5, minmax(0, 1fr)) 24px;
    grid-template-areas:
      "person person person person person toggle"
      "load load load load load load"
      "open overdue week done logged logged";
    gap: 10px 12px;
    padding: 12px 16px;
  }
  .wl-col--person { grid-area: person; }
  .wl-col--toggle { grid-area: toggle; justify-self: end; }
  .wl-col--load { grid-area: load; }
  .wl-col--open { grid-area: open; }
  .wl-col--overdue { grid-area: overdue; }
  .wl-col--due_week { grid-area: week; }
  .wl-col--done { grid-area: done; }
  .wl-col--logged { grid-area: logged; }
  /* Facts read as one quiet line of "21 open · 4 overdue …" (no boxes): denser, calmer. */
  .wl-col[data-label] {
    display: flex;
    flex-direction: row-reverse;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
    justify-self: stretch;
    min-width: 0;
    text-align: left;
  }
  .wl-col[data-label]::before {
    content: attr(data-label);
    overflow: hidden;
    color: var(--text-3);
    font-size: var(--fs-xs);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .wl-col[data-label] .wl-num {
    flex-shrink: 0;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
  }
  .wl-row .wl-tasks {
    margin: 8px 10px 10px;
  }
  .wl-row + .wl-row::before {
    left: 16px;
  }
  .wl-tasks__empty,
  .wl-tasks__loading {
    padding-left: 16px;
  }
}
@container (max-width: 479px) {
  .wl-row__main {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 24px;
    grid-template-areas:
      "person person person toggle"
      "load load load load"
      "open overdue week week"
      "done logged logged logged";
    row-gap: 6px;
  }
  .workload-note__legend {
    margin-left: 0;
  }
  .wl-task {
    flex-wrap: wrap;
    row-gap: 2px;
  }
  .wl-task__title {
    flex-basis: calc(100% - 90px);
  }
  .wl-task__meta {
    width: 100%;
    padding-left: 22px;
  }
}

/* -- Invitations as notifications (mail not configured) ------------------------------------------ */
.invite-notices {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.invite-notices:not(:has(.invite-notice)) {
  display: none;
}
.notif-popover__content > .invite-notices {
  margin: 0;
  padding: var(--space-2);
}
.invite-notice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--card-ring), var(--shadow-xs);
}
.invite-notice__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.invite-notice__text strong {
  font-weight: var(--fw-semibold);
}
.invite-notice__text span {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.invite-notice__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-1);
}
