/* ==========================================================================
   Components

   Every reusable piece of the interface, named for what it is. Each one is
   shown with its markup on /styleguide/; a new component is added here and
   there in the same change. Reads tokens.css and nothing else: no colour,
   type size or pixel length is written in this file.

    1. Icon, logo, brand        9. Form field            17. Note
    2. Card                    10. Grouped list          18. Empty state
    3. Button, icon button     11. Sheet, menu           19. Pagination
    4. Badge, dot              12. Tabs                  20. Table
    5. Chip, sale mode         13. Toast                 21. Page header
    6. Eyebrow, tile, avatar   14. Stat                  22. Breadcrumb, search
    7. Segmented, switch       15. Meter, progress       23. Bento
    8. Check, pick             16. Heatmap               24. IncerCard
                                                         24b. Profile head
                                                         24c. Conversation
                                                         25. Loading · motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Icon, logo, brand
   -------------------------------------------------------------------------- */

/* One stroke set on a 24 unit grid, drawn from the sprite by {% icon %} */
.icon {
  inline-size: var(--icon-em);
  block-size: var(--icon-em);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm {
  inline-size: var(--icon-em-sm);
  block-size: var(--icon-em-sm);
}
/* The filled "verified" mark: a green disc with a paper tick, the one place
   besides the verified chip where green is drawn */
.icon--verified {
  color: var(--verified);
  stroke: var(--paper);
  filter: var(--verified-glow-icon);
}

/* The white mark, used as an image */
.logo {
  flex: none;
  inline-size: var(--logo-w);
  block-size: auto;
  aspect-ratio: var(--logo-ratio);
}
/* On paper the white mark sits in a black tile */
.logo-tile {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: var(--logo-tile);
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  background: var(--on-paper);
}
.logo-tile .logo {
  inline-size: 58%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2h);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-control);
}

/* --------------------------------------------------------------------------
   2. Card: the glass panel
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-xl);
  background: var(--panel);
  box-shadow: var(--highlight);
}
.card--pad {
  padding: var(--sp-6);
}
/* A heading that stays in view while what it heads scrolls under it (a programme's day). It sits on a glass
   card, so it wears the card's surface made opaque (the glass over the canvas): no band of the page's black
   across the card, and nothing that scrolls under it shows through. */
.sticky-heading {
  position: sticky;
  inset-block-start: var(--header-h);
  z-index: var(--z-lift);
  padding-block: var(--sp-2);
  background: linear-gradient(var(--surface-1), var(--surface-1)), var(--bg);
}

/* A picture that belongs to the page (an event's cover, the map of its stands): as wide as its column, rounded,
   its caption below. */
.figure {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin: 0;
}
.figure img {
  inline-size: 100%;
  block-size: auto;
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-lg);
}
/* Lit from above in white: the card that carries the answer */
.card--accent {
  border-color: var(--accent-line);
  background: radial-gradient(110% 70% at 50% 0%, var(--accent-haze), transparent 70%), var(--panel);
}
/* A request: a softer neutral light from its corner */
.card--info {
  border-color: var(--info-line);
  background: radial-gradient(60% 160% at 100% 0%, var(--info-haze), transparent 70%), var(--panel);
}
/* A card that is one link: it rises a little under the pointer */
.card--interactive {
  transition: border-color var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.card--interactive:hover {
  border-color: var(--hairline-strong);
  transform: var(--lift);
}
.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-block-end: var(--sp-5);
}
/* A chip beside a heading keeps the product's fixed words on one line, and the heading gives way, wrapping
   (M2 Task 7, fix round 1, B/M-5). The chip is still never wider than the card, so a written value wraps. */
.card__head > :first-child {
  flex: 1 1 0;
  min-inline-size: 0;
}
.card__head > .chip,
.card__head > .cluster {
  flex: none;
  max-inline-size: 100%;
}
.card__title {
  font-size: var(--fs-lg-plus);
}
/* In a card laid out as a stack, the stack's gap is the space under the head */
.stack > .card__head {
  margin-block-end: 0;
}
.card__sub {
  margin-block-start: var(--sp-half);
  color: var(--text-muted);
  font-size: var(--fs-md);
  line-height: var(--lh-ui);
}
/* A card that holds one form: no wider than a comfortable line of text */
.card--form {
  max-inline-size: var(--prose-w);
}

/* --------------------------------------------------------------------------
   3. Button, icon button
   -------------------------------------------------------------------------- */

/* A pill with a press state. One primary button per view. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-block-size: var(--control-h);
  padding-inline: var(--sp-5);
  border: var(--line) solid transparent;
  border-radius: var(--r-full);
  background: transparent;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  line-height: var(--lh-control);
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}
.btn:active {
  transform: var(--press);
}
.btn--primary {
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: var(--fw-bold);
  box-shadow: var(--highlight-strong), var(--glow-accent);
}
.btn--primary:hover {
  background: var(--accent-fill-hover);
}
.btn--secondary {
  border-color: var(--hairline-strong);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--highlight);
}
.btn--secondary:hover {
  background: var(--surface-3);
}
.btn--ghost {
  color: var(--text-2);
}
.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
/* Something that cannot be undone: tinted, never filled */
.btn--danger {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}
.btn--danger:hover {
  background: var(--danger-line);
  color: var(--text);
}
.btn--lg {
  min-block-size: var(--control-h-lg);
  padding-inline: var(--sp-8);
  font-size: var(--fs-lg);
}
.btn--sm {
  min-block-size: var(--control-h-sm);
  padding-inline: var(--sp-4);
  font-size: var(--fs-md);
}
/* Full width; a long label wraps instead of pushing past a narrow screen */
.btn--block {
  inline-size: 100%;
  padding-block: var(--sp-2);
  white-space: normal;
  text-align: center;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: var(--disabled);
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}

/* Round icon button; an unread count sits on its corner as a badge */
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  inline-size: var(--control-h);
  block-size: var(--control-h);
  padding: 0;
  border: 0;
  border-radius: var(--r-round);
  background: transparent;
  color: var(--text-2);
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.icon-btn:active {
  transform: var(--press-strong);
}
.icon-btn .icon {
  inline-size: var(--icon-xl);
  block-size: var(--icon-xl);
}
.icon-btn--glass {
  background: var(--surface-2);
  box-shadow: var(--ring-hairline);
}
.icon-btn--sm {
  inline-size: var(--control-h-sm);
  block-size: var(--control-h-sm);
}
.icon-btn--sm .icon {
  inline-size: var(--icon-md);
  block-size: var(--icon-md);
}

/* --------------------------------------------------------------------------
   4. Badge, dot
   -------------------------------------------------------------------------- */

/* A count: unread messages, results in a tab */
.badge {
  display: inline-block;
  min-inline-size: var(--badge);
  block-size: var(--badge);
  padding-inline: var(--sp-1);
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  line-height: var(--badge);
  text-align: center;
}
.badge--lg {
  min-inline-size: var(--badge-lg);
  block-size: var(--badge-lg);
  padding-inline: var(--sp-1h);
  font-size: var(--fs-xs);
  line-height: var(--badge-lg);
}
.badge--muted {
  background: var(--surface-3);
  color: var(--text);
}
/* On the corner of an icon button's icon: its inline-start edge is fixed just
   past the icon's middle and a longer count grows outward, away from the
   icon, so the bell or the message icon stays readable at any count */
.badge--corner {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: calc(50% + var(--sp-2));
  box-shadow: var(--ring-canvas);
}
/* Beside the icon of a tab bar entry, at its upper outer corner: the edge
   nearest the icon is fixed just outside it, so a longer count grows away
   from the icon and never covers a corner of it */
.badge--tab {
  position: absolute;
  inset-block-start: var(--sp-1);
  inset-inline-start: calc(50% + var(--icon-2xl) / 2 + var(--sp-half));
  box-shadow: var(--ring-canvas);
}

/* A small light: "live", "selected", the tone of a toast */
.dot {
  flex: none;
  inline-size: var(--dot-size);
  block-size: var(--dot-size);
  border-radius: var(--r-round);
  background: var(--accent);
  box-shadow: var(--glow-dot);
}
.dot--danger {
  background: var(--danger);
  box-shadow: var(--glow-dot-danger);
}

/* --------------------------------------------------------------------------
   5. Chip, sale mode
   -------------------------------------------------------------------------- */

/* A place a part is swapped into, with no box of its own (M2 Task 7, fix round 1, B/I-2): always in the page,
   so an answer can draw a block into it out of band; empty, it takes no room in the stack around it */
.swap-place {
  display: contents;
}
/* A link that is a line of its own, a finger tall, wrapping where it must: a person named beside a row
   («برای ملاقات: …», M2 Task 6 fix round 2), and every link at a block's foot (fix round 1, B/M-4) */
.row-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-block-size: var(--tap);
  min-inline-size: 0;
  overflow-wrap: anywhere;
}
/* A pill that states a fact: a status, a verification, a label */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1h);
  min-block-size: var(--chip-h);
  padding-inline: var(--sp-3);
  border: var(--line) solid var(--hairline-strong);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-control);
  /* A chip is never wider than what holds it: a long one wraps where it must, a short one looks as it always
     did (M2 Task 6 fix round 2, B/I-3). A name somebody wrote is still a line of text, not a chip. */
  max-inline-size: 100%;
  min-inline-size: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.chip .icon {
  inline-size: var(--icon-xs);
  block-size: var(--icon-xs);
  color: var(--text-muted);
}
.chip--neutral {
  border-color: var(--hairline);
}
/* Green means verified, and nothing else: a trust level, a verified
   organisation, exhibitor, record or credential */
.chip--verified {
  border-color: var(--verified-line);
  background: var(--verified-soft);
  color: var(--verified);
}
.chip--info {
  border-color: var(--info-line);
  background: var(--info-soft);
  color: var(--info);
}
.chip--warn {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
}
.chip--danger {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}
/* Sample data and everything that involves it wears this label */
.chip--demo {
  border-style: dashed;
  border-color: var(--control-line);
  background: transparent;
  color: var(--text-2);
}
.chip--verified .icon,
.chip--info .icon,
.chip--warn .icon,
.chip--danger .icon {
  color: inherit;
}
.chip--sm {
  min-block-size: var(--chip-h-sm);
  padding-inline: var(--sp-2);
  font-size: var(--fs-2xs);
}
.chip--sm .icon {
  inline-size: var(--icon-3xs);
  block-size: var(--icon-3xs);
}

/* Sale-mode chip. The opaque layer keeps it legible on a picture. */
.mode {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-block-size: var(--chip-h);
  padding-inline: var(--sp-2h) var(--sp-3);
  border: var(--line) solid var(--mode-line);
  border-radius: var(--r-full);
  background: linear-gradient(var(--mode-soft), var(--mode-soft)), var(--bg-raised-2);
  color: var(--mode-ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: var(--lh-control);
  white-space: nowrap;
}
.mode .icon {
  inline-size: var(--icon-2xs);
  block-size: var(--icon-2xs);
}
.mode--fixed {
  --mode-ink: var(--mode-fixed);
  --mode-soft: var(--mode-fixed-soft);
  --mode-line: var(--mode-fixed-line);
}
.mode--open {
  --mode-ink: var(--mode-open);
  --mode-soft: var(--mode-open-soft);
  --mode-line: var(--mode-open-line);
}
.mode--sealed {
  --mode-ink: var(--mode-sealed);
  --mode-soft: var(--mode-sealed-soft);
  --mode-line: var(--mode-sealed-line);
}
.mode--dutch {
  --mode-ink: var(--mode-dutch);
  --mode-soft: var(--mode-dutch-soft);
  --mode-line: var(--mode-dutch-line);
}
.mode--standing {
  --mode-ink: var(--mode-standing);
  --mode-soft: var(--mode-standing-soft);
  --mode-line: var(--mode-standing-line);
}
/* The same colour as a dot, beside a filter option */
.mode-dot {
  flex: none;
  inline-size: var(--sp-2);
  block-size: var(--sp-2);
  border-radius: var(--r-round);
  background: currentColor;
  box-shadow: var(--glow-current);
  color: var(--mode-ink);
}

/* --------------------------------------------------------------------------
   6. Eyebrow, tile, avatar
   -------------------------------------------------------------------------- */

/* The small pill above a heading */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding-block: var(--sp-fine);
  padding-inline: var(--sp-3h) var(--sp-4);
  border: var(--line) solid var(--hairline-strong);
  border-radius: var(--r-full);
  background: var(--surface-2);
  box-shadow: var(--highlight);
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-ui);
}
.eyebrow .icon {
  inline-size: var(--icon-md);
  block-size: var(--icon-md);
  color: var(--accent);
}

/* Icon tile: a rounded square; one variant is lit */
.tile {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: var(--tile);
  block-size: var(--tile);
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: var(--highlight);
  color: var(--text-2);
}
.tile .icon {
  inline-size: var(--icon-xl);
  block-size: var(--icon-xl);
}
.tile--sm {
  inline-size: var(--tile-sm);
  block-size: var(--tile-sm);
  border-radius: var(--r-sm);
}
.tile--sm .icon {
  inline-size: var(--icon-md);
  block-size: var(--icon-md);
}
.tile--accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  box-shadow: var(--highlight), var(--glow-tile);
  color: var(--accent);
}
.tile--info {
  border-color: var(--info-line);
  background: var(--info-soft);
  box-shadow: var(--highlight), var(--glow-tile-info);
  color: var(--info);
}

/* Avatar: initials on a white tint, or the picture */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  inline-size: var(--avatar-sm);
  aspect-ratio: 1;
  border-radius: var(--r-round);
  background: var(--accent-soft);
  box-shadow: var(--ring-accent);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: var(--lh-flat);
  overflow: hidden;
}
.avatar .icon {
  inline-size: 55%;
  block-size: 55%;
}
.avatar__image {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}
.avatar--sm {
  inline-size: var(--avatar-sm);
  font-size: var(--fs-sm);
}
.avatar--md {
  inline-size: var(--avatar-md);
  font-size: var(--fs-base);
}
.avatar--xl {
  inline-size: var(--avatar-xl);
  font-size: var(--fs-3xl-plus);
}
/* The signed-in member's own mark in the top bar */
.avatar--neutral {
  background: var(--surface-3);
  box-shadow: var(--ring-hairline);
  color: var(--text);
}
/* The subject of a page: lit */
.avatar--lit {
  box-shadow: var(--ring-accent), var(--glow-avatar);
}

/* --------------------------------------------------------------------------
   7. Segmented control, switch
   -------------------------------------------------------------------------- */

/* Two to four views of one thing, with a raised thumb */
.segmented {
  display: inline-flex;
  gap: var(--sp-half);
  padding: var(--sp-fine);
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.segmented__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1h);
  min-block-size: var(--control-h-sm);
  padding-inline: var(--sp-5);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-control);
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.segmented__item:hover {
  color: var(--text);
}
.segmented__item:active {
  transform: var(--press);
}
/* The chosen one among pills is white with a black label, as the primary action is */
.segmented__item[aria-pressed="true"],
.segmented__item[aria-current="true"],
.segmented__item[aria-current="page"] {
  background: var(--accent-fill);
  box-shadow: var(--shadow-thumb);
  color: var(--on-accent);
  font-weight: var(--fw-bold);
}
.segmented--icons .segmented__item {
  inline-size: var(--control-h-md);
  padding: 0;
}
.segmented__item:disabled,
.segmented__item[aria-disabled="true"] {
  opacity: var(--disabled);
  cursor: not-allowed;
  pointer-events: none;
}

/* Switch, iOS proportions */
.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-block-size: var(--tap);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-control);
  cursor: pointer;
}
.switch input {
  position: relative;
  flex: none;
  inline-size: var(--switch-w);
  block-size: var(--switch-h);
  margin: 0;
  border-radius: var(--r-full);
  background: var(--surface-3);
  box-shadow: var(--ring-hairline);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
}
.switch input::after {
  content: "";
  position: absolute;
  inset-block-start: var(--sp-half);
  inset-inline-start: var(--sp-half);
  inline-size: var(--switch-thumb);
  block-size: var(--switch-thumb);
  border-radius: var(--r-round);
  background: var(--paper);
  box-shadow: var(--shadow-thumb);
  transition: inset-inline-start var(--dur-slow) var(--ease);
}
.switch input:checked {
  background: var(--accent);
  box-shadow: var(--glow-switch);
}
.switch input:checked::after {
  inset-inline-start: calc(var(--sp-half) + var(--switch-travel));
  /* on the white track the thumb is the label's black */
  background: var(--on-accent);
}
/* With its own appearance removed a disabled control would look live: every
   control that can be disabled takes the same dimmed look and cursor. */
.switch input:disabled {
  opacity: var(--disabled);
  cursor: not-allowed;
}
.switch:has(input:disabled) {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   8. Check, pick
   -------------------------------------------------------------------------- */

/* A checkbox with its label: the round iOS check */
.check {
  display: flex;
  align-items: center;
  gap: var(--sp-2h);
  min-block-size: var(--row-h);
  color: var(--text);
  font-size: var(--fs-md);
  line-height: var(--lh-control);
  cursor: pointer;
}
.check input {
  display: grid;
  place-content: center;
  flex: none;
  inline-size: var(--check-size);
  block-size: var(--check-size);
  margin: 0;
  border: var(--line-control) solid var(--control-line);
  border-radius: var(--r-round);
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.check:hover input {
  border-color: var(--text-2);
}
.check input:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: var(--glow-check);
}
.check input:checked::after {
  content: "";
  inline-size: var(--sp-2h);
  block-size: var(--sp-1h);
  /* a drawn tick, so physical sides are intended here */
  border: solid var(--on-accent);
  border-width: 0 0 var(--line-focus) var(--line-focus);
  transform: translateY(calc(-1 * var(--line))) rotate(-45deg);
}
.check input[aria-invalid="true"] {
  border-color: var(--danger);
}
.check input:disabled {
  opacity: var(--disabled);
  cursor: not-allowed;
}
.check:has(input:disabled) {
  color: var(--text-muted);
  cursor: not-allowed;
}
.check:has(input:disabled):hover input {
  border-color: var(--control-line);
}
.check__count {
  margin-inline-start: auto;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

/* A few options as pills: the whole pill is the control */
.picks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
}
/* Two to a row: a pick whose label is longer than a word (free hours «۱۰:۰۰ تا ۱۰:۳۰») */
.picks--pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
/* Picks grouped under a day: the day's date as the group's heading (free time by day) */
.slot-day {
  display: grid;
  gap: var(--sp-2);
}
.slot-day__heading {
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}
.pick {
  position: relative;
  cursor: pointer;
}
.pick input {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.pick span {
  display: grid;
  place-items: center;
  min-block-size: var(--row-h);
  border: var(--line) solid var(--hairline-strong);
  border-radius: var(--r-full);
  background: var(--surface-1);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-control);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}
.pick:hover span {
  border-color: var(--control-line);
}
.pick input:checked + span {
  border-color: var(--accent-fill);
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: var(--fw-bold);
}
/* What sits inside a chosen pill takes its black ink: a chip, an icon, a count */
.pick input:checked + span .chip {
  border-color: var(--on-accent);
  background: transparent;
  color: var(--on-accent);
}
.pick input:checked + span .chip .icon {
  color: inherit;
}
.pick input:focus-visible + span {
  outline: var(--line-focus) solid var(--focus);
  outline-offset: var(--line-focus);
}
.pick input:disabled {
  cursor: not-allowed;
}
.pick input:disabled + span {
  opacity: var(--disabled);
}
.pick:has(input:disabled):hover span {
  border-color: var(--hairline-strong);
}

/* --------------------------------------------------------------------------
   9. Form field: label, control, help and error. Rendered by {% form_field %}.
   -------------------------------------------------------------------------- */
.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-1h);
}
.field__label {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-control);
}
.field__optional {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-regular);
}
.field__control {
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: var(--control-h-lg);
  padding-inline: var(--sp-4);
  /* at rest the box is drawn with the controls' line (3:1 on every surface): a hairline would hide it */
  border: var(--line) solid var(--control-line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--fs-lg);
  line-height: var(--lh-control);
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}
.field__control::placeholder {
  color: var(--placeholder);
  opacity: 1;
}
.field__control:hover {
  border-color: var(--text-muted);
}
/* No outline here: the approved look is the border and its halo. The halo
   alone is too faint to count, so the focused border is the solid accent. */
.field__control:focus {
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}
/* A number typed left to right still lines up with the Persian labels */
.field__control[dir="ltr"] {
  text-align: end;
}
textarea.field__control {
  min-block-size: var(--textarea-h);
  padding-block: var(--sp-3);
  line-height: var(--lh-ui);
  resize: vertical;
}
select.field__control {
  padding-inline-end: var(--sp-10);
  cursor: pointer;
}
/* Options are drawn by the system: give them the opaque canvas to sit on */
select.field__control option {
  background: var(--bg-raised-2);
  color: var(--text);
}
.field__select {
  position: relative;
  display: block;
  min-inline-size: 0;
}
.field__select .icon {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: var(--sp-3);
  inline-size: var(--icon-xs);
  block-size: var(--icon-xs);
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
/* Several controls under one label: the three selects of a Jalali date */
.field__controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
}
/* Three to a row: thinner padding and the chevron nearer the edge, so the
   year stays whole on a 320 screen */
.field__controls select.field__control {
  padding-inline: var(--sp-2) var(--sp-8);
}
.field__controls .field__select .icon {
  inset-inline-end: var(--sp-2);
  inline-size: var(--icon-xs);
}
/* Read, not edited: no well to type into, a dashed edge */
.field__control[readonly] {
  border-style: dashed;
  background: transparent;
  color: var(--text-2);
}
.field__control:disabled {
  opacity: var(--disabled);
  cursor: not-allowed;
}
/* a disabled field does not answer the pointer: it keeps its resting border */
.field__control:disabled:hover {
  border-color: var(--control-line);
}
.field__help {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-ui);
}
.field__errors {
  display: grid;
  gap: var(--sp-half);
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-ui);
}
.field--invalid .field__control {
  border-color: var(--danger-border);
}
.field--invalid .field__control:focus {
  border-color: var(--danger);
  box-shadow: var(--ring-danger);
}
.field--check .check {
  min-block-size: var(--tap);
  align-items: flex-start;
  padding-block: var(--sp-2h);
}
.field--check .check input {
  margin-block-start: var(--sp-half);
}
/* A file to upload: the system's own picker, framed like the other controls */
.field__file {
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: var(--control-h-lg);
  padding: var(--sp-2) var(--sp-3);
  border: var(--line) dashed var(--control-line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--text-2);
  font-size: var(--fs-md);
  line-height: var(--lh-control);
  outline: 0;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field__file:hover {
  border-color: var(--text-muted);
}
.field__file:focus-visible {
  border-style: solid;
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}
.field__file::file-selector-button {
  margin-inline-end: var(--sp-3);
  padding: var(--sp-1) var(--sp-4);
  border: var(--line) solid var(--hairline-strong);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.field__file:disabled {
  opacity: var(--disabled);
  cursor: not-allowed;
}
.field--invalid .field__file {
  border-color: var(--danger-border);
}

/* --------------------------------------------------------------------------
   10. Grouped list, in the manner of iOS Settings
   -------------------------------------------------------------------------- */
.grouped-list {
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  overflow: hidden;
}
/* The list clips its rounded corners, so a row's ring is drawn inside the row */
.grouped-list__row:focus-visible {
  outline-offset: calc(-1 * var(--ring-room));
}
.grouped-list__row {
  position: relative;
  display: flex;
  /* what does not fit beside the text goes under it, never over it */
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4);
  min-block-size: var(--control-h-lg);
  padding: var(--sp-3) var(--sp-4);
}
/* the separator starts where the text starts, not under the tile */
.grouped-list__row + .grouped-list__row::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: var(--row-inset, var(--sp-4)) 0;
  block-size: var(--line);
  background: var(--hairline);
}
.grouped-list--tiles {
  --row-inset: calc(var(--tile) + 2 * var(--sp-4));
}
.grouped-list--tiles .grouped-list__row {
  align-items: flex-start;
  padding-block: var(--sp-4);
}
a.grouped-list__row,
button.grouped-list__row {
  inline-size: 100%;
  border: 0;
  background: transparent;
  text-align: start;
  transition: background-color var(--dur) var(--ease);
}
a.grouped-list__row:hover,
button.grouped-list__row:hover {
  background: var(--surface-2);
}
.grouped-list__main {
  flex: 1 1 var(--row-main-min);
  min-inline-size: 0;
}
/* a chip at the end of a row wraps its own words rather than leave the card */
.grouped-list__row > .chip {
  max-inline-size: 100%;
  white-space: normal;
}
.grouped-list__title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  line-height: var(--lh-row-title);
}
.grouped-list__text {
  color: var(--text-2);
  font-size: var(--fs-md);
}
.grouped-list__aside {
  flex: none;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
/* an unread light in front of the time */
.grouped-list__aside .dot {
  display: inline-block;
  margin-inline-end: var(--sp-2);
}
.grouped-list__main .chip {
  margin-block-start: var(--sp-1h);
}
/* the chevron of a row that is one link sits in the middle of the row, however tall */
.grouped-list__row > .icon:last-child {
  align-self: center;
}

/* --------------------------------------------------------------------------
   11. Sheet, menu
   A sheet rises from the bottom edge. One base, .sheet, is a sheet at
   every width; the display-only modifiers --until-wide and --until-medium
   keep it a sheet only below that width and give the element back to the
   page above it (the app navigation, the public menu).
   -------------------------------------------------------------------------- */
.sheet__grabber {
  display: none;
  inline-size: var(--grabber-w);
  block-size: var(--grabber-h);
  margin: var(--sp-1) auto var(--sp-3);
  border-radius: var(--r-full);
  background: var(--control-line);
}
.sheet__head {
  display: none;
  align-items: center;
  justify-content: space-between;
  min-block-size: var(--tap);
  margin-block-end: var(--sp-3);
  padding-inline: var(--sp-1);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
}
.sheet__head .icon-btn {
  inline-size: var(--tap);
  block-size: var(--tap);
}
/* the sheet's name is its heading: the dialog is labelled by it and opens on it */
.sheet__title {
  margin: 0;
  font: inherit;
}

/* The base: a sheet at every width. Hidden below the edge until opened. */
.sheet {
  position: fixed;
  inset-inline: 0;
  inset-block: auto 0;
  z-index: var(--z-sheet);
  display: block;
  block-size: auto;
  max-block-size: 86vh;
  max-block-size: 86dvh;
  max-inline-size: var(--sheet-w);
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-4) calc(var(--sp-6) + var(--safe-bottom));
  border: var(--line) solid var(--hairline-strong);
  border-block-end: 0;
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  background: var(--sheet);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--highlight), var(--shadow-pop);
  overflow-y: auto;
  visibility: hidden;
  transform: var(--sheet-away);
  transition: transform var(--dur-slow) var(--ease), visibility 0s linear var(--dur-slow);
}
.sheet.is-open {
  visibility: visible;
  transform: none;
  transition: transform var(--dur-slow) var(--ease), visibility 0s;
}
.sheet > .sheet__grabber {
  display: block;
}
.sheet > .sheet__head {
  display: flex;
}
/* A sheet that is one only on narrower screens spans the whole width there */
.sheet--until-wide,
.sheet--until-medium {
  max-inline-size: none;
  margin: 0;
}

/* Display-only modifiers: above its width the same element is an ordinary
   part of the page (the app navigation, the public menu), and every
   declaration of the base gives way to what the page itself says of it. */
@media (min-width: 1101px) {
  .sheet--until-wide {
    position: revert;
    inset: revert;
    z-index: var(--z-auto);
    display: revert;
    block-size: revert;
    max-block-size: revert;
    max-inline-size: revert;
    margin: revert;
    padding: revert;
    border: revert;
    border-radius: 0;
    background: revert;
    -webkit-backdrop-filter: revert;
    backdrop-filter: revert;
    box-shadow: none;
    overflow-y: revert;
    visibility: revert;
    transform: revert;
    transition: revert;
  }
  .sheet--until-wide > .sheet__grabber,
  .sheet--until-wide > .sheet__head {
    display: none;
  }
}

@media (min-width: 901px) {
  .sheet--until-medium {
    position: revert;
    inset: revert;
    z-index: var(--z-auto);
    display: revert;
    block-size: revert;
    max-block-size: revert;
    max-inline-size: revert;
    margin: revert;
    padding: revert;
    border: revert;
    border-radius: 0;
    background: revert;
    -webkit-backdrop-filter: revert;
    backdrop-filter: revert;
    box-shadow: none;
    overflow-y: revert;
    visibility: revert;
    transform: revert;
    transition: revert;
  }
  .sheet--until-medium > .sheet__grabber,
  .sheet--until-medium > .sheet__head {
    display: none;
  }
}

/* The scrim behind an open sheet; a button, so a tap on it closes the sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-scrim);
  padding: 0;
  border: 0;
  background: var(--scrim);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-slow) var(--ease), visibility 0s linear var(--dur-slow);
}
.sheet-open .sheet-backdrop {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur-slow) var(--ease), visibility 0s;
}

/* Menu: a <details> whose panel floats under its summary */
.menu {
  position: relative;
}
.menu > summary {
  list-style: none;
  cursor: pointer;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu__panel {
  position: absolute;
  inset-block-start: calc(100% + var(--sp-2));
  inset-inline-end: 0;
  z-index: var(--z-menu);
  inline-size: max-content;
  min-inline-size: var(--menu-w);
  max-inline-size: calc(100vw - 2 * var(--gutter));
  padding: var(--sp-2);
  border: var(--line) solid var(--hairline-strong);
  border-radius: var(--r-lg);
  /* opaque: a menu opens from inside a blurred bar, where a second blur
     cannot reach the page behind it */
  background: var(--bg-raised-2);
  box-shadow: var(--highlight), var(--shadow-pop);
}
.menu__head {
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  margin-block-end: var(--sp-2);
  border-block-end: var(--line) solid var(--hairline);
  line-height: var(--lh-control);
}
.menu__name {
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
}
.menu__meta {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.menu__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  inline-size: 100%;
  min-block-size: var(--tap);
  padding-inline: var(--sp-3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  line-height: var(--lh-control);
  text-align: start;
  transition: background-color var(--dur) var(--ease);
}
.menu__item:hover {
  background: var(--surface-2);
}
.menu__item .icon {
  color: var(--text-muted);
}
.menu__item--danger,
.menu__item--danger .icon {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   12. Tabs: category pills that scroll sideways on a narrow screen
   -------------------------------------------------------------------------- */
/* A strip that scrolls clips on both axes: it keeps the focus ring's reach
   as room inside its edges, and takes the same room back outside them, so
   the pills sit where they would without it. */
.tabs {
  display: flex;
  gap: var(--sp-2);
  padding: var(--ring-room);
  margin: calc(-1 * var(--ring-room));
  overflow-x: auto;
  /* a tab scrolled into view stops with its ring inside the strip */
  scroll-padding-inline: var(--ring-room);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tabs__tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
  min-block-size: var(--control-h-md);
  padding-inline: var(--sp-4);
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-full);
  background: var(--surface-1);
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-control);
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.tabs__tab:hover {
  border-color: var(--hairline-strong);
  color: var(--text);
}
.tabs__tab:active {
  transform: var(--press);
}
.tabs__tab[aria-current="true"],
.tabs__tab[aria-current="page"],
.tabs__tab[aria-selected="true"] {
  border-color: var(--accent-fill);
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: var(--fw-bold);
}
.tabs__tab[aria-current="true"] .badge,
.tabs__tab[aria-current="page"] .badge,
.tabs__tab[aria-selected="true"] .badge {
  background: var(--on-accent);
  color: var(--accent-fill);
}
.tabs__tab:disabled,
.tabs__tab[aria-disabled="true"] {
  opacity: var(--disabled);
  cursor: not-allowed;
  pointer-events: none;
}
.tabs__panel {
  margin-block-start: var(--sp-4);
}

/* --------------------------------------------------------------------------
   13. Toast: what just happened, said once and gone
   -------------------------------------------------------------------------- */
.toasts {
  position: fixed;
  inset-inline: 0;
  inset-block-end: calc(var(--sp-5) + var(--safe-bottom));
  z-index: var(--z-toast);
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  padding-inline: var(--gutter);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-inline-size: min(100%, var(--toast-w));
  min-block-size: var(--control-h-lg);
  padding-block: var(--sp-1h);
  padding-inline: var(--sp-4) var(--sp-1h);
  border: var(--line) solid var(--hairline-strong);
  border-radius: var(--r-2xl);
  background: var(--sheet);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--highlight), var(--shadow-pop);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-ui);
  pointer-events: auto;
  animation: toast-in var(--dur-slow) var(--ease);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.toast.is-leaving {
  opacity: 0;
  transform: var(--toast-away);
}
.toast__text {
  flex: 1;
  min-inline-size: 0;
}
/* Each level of Django's messages has its own icon and edge, so success and
   error differ by shape as well as by colour. */
.toast__icon {
  inline-size: var(--icon-lg);
  block-size: var(--icon-lg);
  color: var(--info);
}
.toast--debug,
.toast--info {
  border-color: var(--info-line);
}
/* Success and warning are neutral, told apart by their icons; only an error is red */
.toast--success {
  border-color: var(--info-line);
}
.toast--success .toast__icon {
  color: var(--text);
}
.toast--warning {
  border-color: var(--warn-line);
}
.toast--warning .toast__icon {
  color: var(--warn);
}
.toast--error {
  border-color: var(--danger-line);
}
.toast--error .toast__icon {
  color: var(--danger);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: var(--toast-away);
  }
}

/* --------------------------------------------------------------------------
   14. Stat: one figure and what it counts
   -------------------------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  padding: var(--sp-5) var(--sp-6);
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: var(--highlight);
}
.stat dd {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-bold);
  font-variant-numeric: var(--num-display);
  line-height: var(--lh-figure);
}
.stat dt {
  color: var(--text-muted);
  font-size: var(--fs-base);
  line-height: var(--lh-ui);
}
/* The same pair beside an icon, for a row of counts inside a card */
/* The icon lives in the <dt>, beside the label it belongs to, and is drawn
   at the start of the tile, centred on both lines. The padding is the least
   that keeps the icon clear of the label: four tiles in the narrow main
   column between 1181px and about 1300px (the sidebar and the rail beside
   it) are about 110px wide, and «پاسخ فنی» must stay on one line there. */
.stat--compact {
  position: relative;
  padding-block: var(--sp-3);
  padding-inline: calc(var(--sp-3) + var(--icon-xl) + var(--sp-2)) var(--sp-3);
  background: var(--surface-1);
}
.stat--compact .icon {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: var(--sp-3);
  inline-size: var(--icon-xl);
  block-size: var(--icon-xl);
  color: var(--accent);
  transform: translateY(-50%);
}
.stat--compact dd {
  font-size: var(--fs-2xl);
}
.stat--compact dt {
  font-size: var(--fs-sm);
  line-height: var(--lh-control);
}

/* --------------------------------------------------------------------------
   15. Meter, progress
   -------------------------------------------------------------------------- */

/* A score out of five: five segments, each filled by its own share.
   Rendered by {% meter %}, which picks the classes; no inline style. */
.meters {
  display: grid;
  gap: var(--sp-4);
}
.meters__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-block-end: var(--sp-1h);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
}
.meters__value {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  white-space: nowrap;
}
.meters__value b {
  color: var(--text);
  font-size: var(--fs-lg);
}
.meter {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--sp-fine);
  filter: var(--glow-meter);
}
.meter__seg {
  block-size: var(--sp-2);
  border-radius: var(--r-full);
  /* the site reads right to left, so a segment fills from its right edge */
  background: linear-gradient(to left, var(--accent) var(--fill, 0%), var(--surface-3) var(--fill, 0%));
}
[dir="ltr"] .meter__seg {
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--surface-3) var(--fill, 0%));
}
.meter__seg--full { --fill: 100%; }
.meter__seg--f1 { --fill: 10%; }
.meter__seg--f2 { --fill: 20%; }
.meter__seg--f3 { --fill: 30%; }
.meter__seg--f4 { --fill: 40%; }
.meter__seg--f5 { --fill: 50%; }
.meter__seg--f6 { --fill: 60%; }
.meter__seg--f7 { --fill: 70%; }
.meter__seg--f8 { --fill: 80%; }
.meter__seg--f9 { --fill: 90%; }

/* Seconds counting down beside a control. The figure has a place of fixed
   width (proportional digits differ in width), so the words after it stay
   where they are as it changes. */
.countdown__value {
  display: inline-block;
  min-inline-size: var(--countdown-w);
  text-align: center;
}

/* A thin bar for a share of something: <progress value max> */
.progress {
  display: block;
  inline-size: 100%;
  block-size: var(--bar-h);
  border: 0;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--accent);
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}
.progress::-webkit-progress-bar {
  background: transparent;
}
.progress::-webkit-progress-value {
  border-radius: var(--r-full);
  background: currentColor;
}
.progress::-moz-progress-bar {
  border-radius: var(--r-full);
  background: currentColor;
}
.progress--thick {
  block-size: var(--grabber-h);
}
.progress--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   16. Heatmap: a year of activity, 53 weeks by 7 days, five steps of intensity.
   It shows how often, never how much.
   -------------------------------------------------------------------------- */
.heat-0 { background: var(--heat-0); }
.heat-1 { background: var(--heat-1); }
.heat-2 { background: var(--heat-2); }
.heat-3 { background: var(--heat-3); }
.heat-4 { background: var(--heat-4); }

.heatmap__body {
  display: flex;
  align-items: stretch;
  gap: var(--sp-2);
  padding-block-start: var(--sp-6);
}
.heatmap__days {
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: var(--sp-fine);
  color: var(--text-muted);
  font-size: var(--fs-2xs);
  line-height: var(--lh-flat);
}
.heatmap__days span {
  align-self: center;
}
.heatmap__days span:nth-child(1) { grid-row: 1; }
.heatmap__days span:nth-child(2) { grid-row: 3; }
.heatmap__days span:nth-child(3) { grid-row: 5; }
.heatmap__days span:nth-child(4) { grid-row: 7; }
.heatmap__grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(53, minmax(0, 1fr));
  gap: var(--sp-fine);
  min-inline-size: 0;
}
.heatmap__week {
  position: relative;
  display: grid;
  grid-template-rows: repeat(7, auto);
  gap: var(--sp-fine);
}
/* the month a week starts in, written above its column */
.heatmap__week[data-month]::before {
  content: attr(data-month);
  position: absolute;
  inset-block-end: calc(100% + var(--sp-1));
  inset-inline-start: 0;
  color: var(--text-muted);
  font-size: var(--fs-2xs);
  line-height: var(--lh-figure);
  white-space: nowrap;
}
/* Where the columns are too narrow for every month's name, a name that would
   run into the one before it is left out (data-month-crowded): up to 900px,
   and again from 1181px, where the sidebar and the rail both stand beside
   the main column, until at 1420px the column is as wide as it was. Between
   the two the main column has the page to itself and every name has room.
   Here, after the rule that writes the names, so it wins. */
@media (max-width: 900px), (min-width: 1181px) and (max-width: 1420px) {
  .heatmap__week[data-month-crowded]::before {
    content: none;
  }
}
.heatmap__week i,
.heatmap__legend i {
  display: block;
  aspect-ratio: 1;
  border-radius: var(--r-2xs);
}
.heatmap__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin-block-start: var(--sp-3);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.heatmap__legend {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}
.heatmap__legend i {
  inline-size: var(--sp-3);
}
.heatmap__legend span:first-child {
  margin-inline-end: var(--sp-1);
}
.heatmap__legend span:last-child {
  margin-inline-start: var(--sp-1);
}

/* --------------------------------------------------------------------------
   17. Note: a line of explanation, or a refusal, beside what it is about
   -------------------------------------------------------------------------- */
.note {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: var(--line) solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-ui);
}
.note .icon {
  margin-block-start: var(--nudge-sm);
  inline-size: var(--icon-xs);
  block-size: var(--icon-xs);
  color: var(--text-muted);
}
.note--danger {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-weight: var(--fw-medium);
}
.note--warn {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
}
.note--success {
  border-color: var(--info-line);
  background: var(--info-soft);
  color: var(--text);
}
.note--danger .icon,
.note--warn .icon,
.note--success .icon {
  color: inherit;
}

/* --------------------------------------------------------------------------
   18. Empty state: every list has one. Rendered by {% empty_state %}.
   -------------------------------------------------------------------------- */
.empty {
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  padding: var(--sp-12) var(--sp-6);
  border: var(--line) dashed var(--hairline-strong);
  border-radius: var(--r-xl);
  background: var(--surface-1);
  text-align: center;
}
.empty .tile {
  margin-block-end: var(--sp-2);
}
.empty__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-heading);
}
.empty__text {
  max-inline-size: var(--measure);
  color: var(--text-muted);
  font-size: var(--fs-base);
}
.empty__action {
  margin-block-start: var(--sp-3);
}

/* --------------------------------------------------------------------------
   19. Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  margin-block-start: var(--sp-8);
}
.pagination__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1h);
}
.pagination__link,
.pagination__current,
.pagination__gap {
  display: inline-grid;
  place-items: center;
  min-inline-size: var(--control-h);
  min-block-size: var(--control-h);
  padding-inline: var(--sp-3);
  border: var(--line) solid transparent;
  border-radius: var(--r-full);
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-control);
}
.pagination__link {
  border-color: var(--hairline);
  background: var(--surface-1);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}
.pagination__link:hover {
  border-color: var(--hairline-strong);
  background: var(--surface-2);
  color: var(--text);
}
.pagination__current {
  border-color: var(--hairline-strong);
  background: var(--surface-3);
  box-shadow: var(--highlight);
  color: var(--text);
  font-weight: var(--fw-bold);
}
.pagination__gap {
  min-inline-size: 0;
  padding-inline: var(--sp-1);
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   20. Table: for figures that are read across. It scrolls inside its frame.
   -------------------------------------------------------------------------- */
.table-wrap {
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  overflow-x: auto;
}
.table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
  line-height: var(--lh-ui);
}
.table th,
.table td {
  padding: var(--sp-3) var(--sp-4);
  text-align: start;
  vertical-align: middle;
}
.table th {
  border-block-end: var(--line) solid var(--hairline-strong);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.table td {
  border-block-end: var(--line) solid var(--hairline);
}
.table tbody tr:last-child td {
  border-block-end: 0;
}
.table tbody tr {
  transition: background-color var(--dur) var(--ease);
}
.table tbody tr:hover {
  background: var(--surface-1);
}
/* A column of figures lines up on its end edge. The figures are the font's
   own: its tabular digits space out the Persian zero. */
.table .table__num {
  text-align: end;
  white-space: nowrap;
}
/* Several columns of figures: keep its width and scroll inside the frame
   on a narrow screen, instead of squeezing the first column into a ribbon */
.table--wide {
  min-inline-size: var(--table-w);
}

/* --------------------------------------------------------------------------
   21. Page header: the title of an app page, its one line of context, its action
   -------------------------------------------------------------------------- */
.page-header {
  margin-block-end: var(--sp-6);
}
.page-header__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-6);
}
.page-header__title {
  font-size: var(--fs-4xl);
  line-height: var(--lh-snug);
  /* A title as long as a form allows wraps inside the page at 320px, never pushing it sideways. */
  overflow-wrap: anywhere;
}
.page-header__lead {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-block-start: var(--sp-half);
  color: var(--text-muted);
  font-size: var(--fs-base);
}
.page-header__lead .icon {
  margin-block-start: var(--nudge);
  inline-size: var(--icon-sm);
  block-size: var(--icon-sm);
  color: var(--accent);
}
.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.page-header .tabs {
  margin-block-start: calc(var(--sp-5) - var(--ring-room));
}

/* --------------------------------------------------------------------------
   22. Breadcrumb, search
   -------------------------------------------------------------------------- */
.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-muted);
  font-size: var(--fs-md);
  line-height: var(--lh-control);
}
.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
  flex: none;
}
/* The page's own name, always the last crumb, wraps where it needs to, by a back link's rule (decision 24): the
   links before it keep their words whole and the row never widens the page (M2 Task 7, fix round 2, B/I-1). */
.breadcrumb li:last-child {
  flex: 0 1 auto;
  min-inline-size: 0;
  white-space: normal;
}
.breadcrumb li + li::before {
  content: "";
  inline-size: var(--sp-1h);
  block-size: var(--sp-1h);
  border-block-end: var(--line-control) solid var(--text-faint);
  border-inline-end: var(--line-control) solid var(--text-faint);
  transform: rotate(45deg);
}
[dir="ltr"] .breadcrumb li + li::before {
  transform: rotate(-45deg);
}
.breadcrumb a {
  border-radius: var(--r-xs);
  transition: color var(--dur) var(--ease);
}
.breadcrumb a:hover {
  color: var(--text);
}
.breadcrumb [aria-current="page"] {
  color: var(--text);
  font-weight: var(--fw-bold);
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.search {
  position: relative;
}
.search .icon {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: var(--sp-3);
  inline-size: var(--icon-md);
  block-size: var(--icon-md);
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search input {
  inline-size: 100%;
  block-size: var(--control-h-md);
  padding-inline: var(--sp-10) var(--sp-4);
  border: var(--line) solid var(--control-line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--fs-md);
  outline: 0;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}
.search input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}
.search input:hover {
  border-color: var(--text-muted);
}
.search input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}

/* --------------------------------------------------------------------------
   23. Bento: a grid of tiles, each a picture above a few words
   -------------------------------------------------------------------------- */
.bento {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-4);
}
.bento__tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-2xl);
  background: var(--panel);
  box-shadow: var(--highlight);
  overflow: hidden;
  transition: border-color var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.bento__tile:hover {
  border-color: var(--hairline-strong);
  transform: var(--lift);
}
.bento__tile--wide {
  grid-column: span 2;
}
.bento__visual {
  position: relative;
  block-size: var(--bento-visual-h);
  padding: var(--sp-6) var(--sp-6) 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, var(--mask-ink) 68%, transparent 100%);
  mask-image: linear-gradient(to bottom, var(--mask-ink) 68%, transparent 100%);
}
/* light from above */
.bento__visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(70% 70% at 50% 0%, var(--surface-2), transparent 70%);
  pointer-events: none;
}
.bento__tile--lit .bento__visual::before {
  background: radial-gradient(70% 80% at 50% 0%, var(--accent-haze), transparent 72%);
}
.bento__text {
  position: relative;
  padding: var(--sp-2) var(--sp-6) var(--sp-6);
}
.bento__title {
  font-size: var(--fs-xl);
}
.bento__text p {
  margin-block-start: var(--sp-1);
  color: var(--text-muted);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
}
/* Three tiles in a row: three ways to one thing */
.bento--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
/* A tile of words with an icon tile and no picture */
.bento__tile--plain .bento__text {
  display: grid;
  align-content: start;
  gap: var(--sp-2);
  padding-block-start: var(--sp-6);
}
.bento__tile--plain .bento__text p {
  margin-block-start: 0;
}

/* --------------------------------------------------------------------------
   23b. Prose: a long text to be read, like the charter
   -------------------------------------------------------------------------- */
.prose {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-8);
  color: var(--text-2);
  font-size: var(--fs-lg);
  line-height: var(--lh-body);
}
.prose__head {
  display: grid;
  justify-items: start;
  gap: var(--sp-4);
}
.prose__title {
  color: var(--text);
  font-size: var(--fs-title);
  line-height: var(--lh-heading);
}
.prose__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-6);
  font-size: var(--fs-md);
}
.prose__meta dt {
  color: var(--text-muted);
}
.prose__meta dd {
  color: var(--text);
  font-weight: var(--fw-medium);
}
.prose__toc {
  padding: var(--sp-4) var(--sp-5);
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  font-size: var(--fs-md);
}
.prose__toc ol {
  display: grid;
  gap: var(--sp-1);
  /* each heading carries its own number */
  list-style: none;
}
.prose__toc a {
  color: var(--text-2);
}
.prose__toc a:hover {
  color: var(--accent);
}
.prose__section {
  display: grid;
  gap: var(--sp-3);
  max-inline-size: var(--prose-w);
  scroll-margin-block-start: calc(var(--scroll-pad) + var(--acting-offset));
}
.prose__section h2 {
  color: var(--text);
  font-size: var(--fs-2xl);
  line-height: var(--lh-heading);
}
.prose__section ul {
  display: grid;
  gap: var(--sp-2);
  padding-inline-start: var(--sp-5);
  list-style: disc;
}
.prose__section li::marker {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   24. IncerCard: the member card. White, under a spotlight; the one object
   on the black canvas that is paper.
   -------------------------------------------------------------------------- */
.incercard {
  position: relative;
  /* its own stacking context, so the halo stays behind the text and in front
     of whatever the card lies on */
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  inline-size: var(--incercard-w);
  max-inline-size: 100%;
  aspect-ratio: var(--incercard-ratio);
  padding: var(--sp-5) var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--paper-fill);
  box-shadow: var(--shadow-paper);
  color: var(--on-paper);
}
.incercard::before {
  content: "";
  position: absolute;
  z-index: var(--z-under);
  inset: calc(-1 * var(--sp-16)) calc(-1 * var(--sp-20));
  background: radial-gradient(closest-side, var(--paper-glow), transparent);
  pointer-events: none;
}
.incercard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.incercard__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  line-height: var(--lh-control);
}
.incercard__nfc {
  inline-size: var(--icon-3xl);
  block-size: var(--icon-3xl);
  color: var(--on-paper-muted);
  /* mirrored for the right-to-left card; a left-to-right page shows the drawing as it is */
  transform: scaleX(-1);
}
[dir="ltr"] .incercard__nfc {
  transform: none;
}
.incercard__name {
  font-size: var(--fs-2xl-plus);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
}
.incercard__line {
  color: var(--on-paper-muted);
  font-size: var(--fs-xs);
  line-height: var(--lh-ui);
}
/* With the code: the member's card page and its print view. The name and
   the lines on the inline-start side, the code on the inline-end side,
   both sitting on the card's lower edge. */
.incercard__body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
}
.incercard__who {
  display: grid;
  gap: var(--sp-half);
  min-inline-size: 0;
}
.incercard__line--strong {
  color: var(--on-paper);
  font-weight: var(--fw-bold);
}
.incercard__qr {
  flex: none;
  inline-size: var(--incercard-qr);
  color: var(--on-paper);
}

/* A QR code: one inline SVG path in currentColor (cards.services.qr). The
   drawing's viewBox reaches four modules past the matrix on every side and
   its box is painted paper white, so the quiet zone a scanner needs grows
   with the code wherever it is shown: on the card, on paper, on the canvas. */
.qr__code {
  display: block;
  inline-size: 100%;
  block-size: auto;
  background: var(--paper);
}
.qr--paper {
  inline-size: var(--qr-w);
  max-inline-size: 100%;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
  color: var(--on-paper);
}
/* The code to scan at a stand: as wide as its container allows, up to a measure. */
.qr--large {
  inline-size: var(--qr-w-large);
}
.code-show {
  display: grid;
  /* one track that may shrink below the code's own width, so the code
     narrows to its container instead of spilling out of it */
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: var(--sp-3);
  padding-block: var(--sp-4);
}
.code-show__name {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}
/* A stand's code (A-12): Latin, read left to right inside Persian text, and
   never broken at its hyphen however narrow the line */
.stand-code {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}
/* A hall's screen (events): the code takes its size from the screen and its
   words are read from the back of the hall */
.code-show--screen .qr--screen {
  inline-size: var(--qr-w-screen);
}
.code-show--screen .code-show__name {
  font-size: var(--fs-screen);
}
/* the screen's title, over the focus layout's own title size */
.focus__inner--screen .code-show__title {
  font-size: var(--fs-screen-title);
}

/* The stage a card or a code is shown on inside a page card: centred, with
   room for the card's halo. */
.card-stage {
  display: flex;
  justify-content: center;
  padding-block: var(--sp-6);
  /* the card's halo reaches past a phone's edge; clipped sideways only, so
     it still glows above and below the card */
  overflow-x: clip;
}
.card-stage__below {
  margin-block-start: var(--sp-2);
}
/* Where the tab bar shows the page is used with a thumb: the small buttons
   under a card reach the tap height (36px of a small button is not enough). */
@media (max-width: 1100px) {
  .card-stage__below .btn--sm {
    min-block-size: var(--tap);
  }
}
.copy-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-1);
}
.copy-line__value {
  min-inline-size: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A line of facts separated by a dot. The dot belongs to the item after it
   and is not followed by a break opportunity, so a line that wraps never
   ends in one: the dot moves to the next line with its item. */
.meta-line__item + .meta-line__item::before {
  content: "·";
  padding-inline: var(--sp-1h);
}
/* A date is read whole: it moves to the next line rather than split */
.meta-line__item--date {
  white-space: nowrap;
}

/* The actions a tap page offers: each a form with its sentence, under a hairline. */
.tap-actions {
  display: grid;
}
.tap-actions__item + .tap-actions__item {
  margin-block-start: var(--sp-4);
  padding-block-start: var(--sp-4);
  border-block-start: var(--line) solid var(--hairline);
}

/* --------------------------------------------------------------------------
   24b. Profile head: the top of a Daftarche or an organisation's page. The
   avatar under its white light, the name, what they do, a line of facts,
   the chips, then a row of actions under a hairline.
   -------------------------------------------------------------------------- */
.profile-head {
  overflow: hidden;
  background: var(--haze-profile), var(--panel);
}
.profile-head__top {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-5);
}
.profile-head__id {
  flex: 1;
  min-inline-size: 0;
}
.profile-head__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-name);
  line-height: var(--lh-snug);
  overflow-wrap: anywhere;
}
.profile-head__name .icon--verified {
  inline-size: var(--icon-xl);
  block-size: var(--icon-xl);
}
.profile-head__role {
  color: var(--text-2);
  font-size: var(--fs-lg);
  font-weight: var(--fw-medium);
  overflow-wrap: anywhere;
}
.profile-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-5);
  margin-block-start: var(--sp-2);
  color: var(--text-muted);
  font-size: var(--fs-md);
}
.profile-head__meta li {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1h);
}
.profile-head__meta .icon {
  inline-size: var(--icon-sm);
  block-size: var(--icon-sm);
  color: var(--text-faint);
}
.profile-head__meta b {
  color: var(--text);
}
.profile-head__meta a {
  color: inherit;
}
.profile-head__meta a:hover {
  color: var(--text);
}
.profile-head__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-block-start: var(--sp-5);
}
.profile-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-block-start: var(--sp-5);
  padding-block-start: var(--sp-5);
  border-block-start: var(--line) solid var(--hairline);
}
/* a button that posts sits in its own form; the form takes no box of its own.
   Only the container's own forms and buttons: a sheet a header action brings
   is placed after the header, but these rules must not reach into one anyway */
.profile-head__actions > form {
  display: contents;
}
.profile-head__actions > .btn--primary,
.profile-head__actions > form > .btn--primary {
  padding-inline: var(--sp-6);
}
/* a status line in place of the actions: «در انتظار تأیید واحد اعتماد» */
.profile-head__note {
  margin-block-start: var(--sp-5);
}

/* a line in place of an action the viewer cannot take yet: «برای پیام دادن، نخست …» */
.profile-head__hint {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-block-size: var(--tap);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.profile-head__hint .icon {
  flex: none;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   24c. Conversation: an inbox row, the message bubbles, the composer.
   A message is plain text; its links are underlined in the accent. The
   member's own messages sit at the inline end, tinted in the accent.
   -------------------------------------------------------------------------- */
.conversation-row__org {
  margin-inline-start: var(--sp-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
}
/* One line of the last message; the whole text is a tap away. The row is a
   flex line: the «شما:» prefix keeps its width, and the text, whose own
   direction (dir="auto") decides which end is cut, takes the rest and clips
   itself. Clipping on the paragraph would cut the wrong end of a Latin text
   in this right-to-left row. */
.conversation-row__preview {
  display: flex;
  align-items: baseline;
}
.conversation-row__who {
  flex: none;
  margin-inline-end: var(--sp-1);
}
.conversation-row__text {
  flex: 0 1 auto;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-row__preview.is-unread {
  color: var(--text);
  font-weight: var(--fw-medium);
}

.conversation__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-block-end: var(--line) solid var(--hairline);
}
.conversation__who {
  flex: 1;
  min-inline-size: 0;
}
.conversation__name {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
}
.conversation__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.conversation__body {
  padding: var(--sp-4);
}
.conversation__more {
  display: flex;
  justify-content: center;
  margin-block: var(--sp-2) var(--sp-4);
}

.thread {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
/* said only while the conversation has no message: the first one hides it.
   It stands outside the list, which is a live log of the messages alone */
.conversation__body:has(.bubble) .thread__empty {
  display: none;
}

.bubble {
  align-self: flex-start;
  max-inline-size: min(85%, var(--measure));
  padding: var(--sp-2) var(--sp-3);
  border: var(--line) solid var(--hairline);
  border-radius: var(--r-lg);
  border-start-start-radius: var(--r-xs);
  background: var(--surface-2);
  overflow-wrap: anywhere;
}
.bubble--mine {
  align-self: flex-end;
  border-color: var(--accent-line);
  border-start-start-radius: var(--r-lg);
  border-start-end-radius: var(--r-xs);
  background: var(--accent-soft);
}
.bubble__sender {
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}
.bubble__body {
  line-height: var(--lh-snug);
}
/* an address reads left to right inside the Persian sentence, its punctuation kept with it */
.bubble__body a {
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: var(--nudge-sm);
}
.bubble__meta {
  margin-block-start: var(--sp-1);
  color: var(--text-muted);
  font-size: var(--fs-2xs);
  text-align: end;
}

/* The composer stays at the foot of the screen while the conversation scrolls */
.composer-dock {
  position: sticky;
  inset-block-end: var(--sp-4);
  z-index: var(--z-bar);
  margin-block-start: var(--sp-3);
}
.composer {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border: var(--line) solid var(--hairline-strong);
  border-radius: var(--r-xl);
  background: var(--bg-raised-2);
  box-shadow: var(--highlight), var(--shadow-pop);
}
.composer__row {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
}
.composer__row textarea {
  flex: 1;
  min-inline-size: 0;
  min-block-size: var(--tap);
  max-block-size: var(--textarea-h);
  padding: var(--sp-2) var(--sp-3);
  border: var(--line) solid var(--control-line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  line-height: var(--lh-ui);
  resize: none;
  field-sizing: content;
  /* the focus is the border and its halo, as on every text control */
  outline: none;
}
.composer__row textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}
.composer__row textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}
.composer__row textarea[aria-invalid="true"] {
  border-color: var(--danger-border);
}
.composer__row textarea[aria-invalid="true"]:focus-visible {
  border-color: var(--danger);
  box-shadow: var(--ring-danger);
}
.composer__send {
  flex: none;
  border-color: transparent;
  background: var(--accent-fill);
  color: var(--on-accent);
}
.composer__send:hover {
  background: var(--accent-fill-hover);
}
/* while the message is on its way: one tap, one message */
.composer__send:disabled {
  opacity: var(--disabled);
  cursor: progress;
}
.composer__closed {
  flex-wrap: wrap;
  align-items: center;
  background: var(--bg-raised-2);
}
/* the blocker's own way back: «رفع مسدودی» at the end of the line */
.composer__closed form {
  margin-inline-start: auto;
}

@media (max-width: 1100px) {
  /* the tab bar carries «پیام‌ها» and its count here; the top bar's button would say it twice */
  .topbar__messages {
    display: none;
  }
  /* above the bottom tab bar */
  .composer-dock {
    inset-block-end: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-2));
  }
}

/* --------------------------------------------------------------------------
   25. Loading, narrow screens, reduced motion
   -------------------------------------------------------------------------- */

/* HTMX marks the element that sent a request with .htmx-request. The library's
   own stylesheet is switched off (it would be an inline style), so the two
   rules it would have injected live here. */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}
/* A spinner inside a waiting line of text sits on the line, beside its words */
.htmx-indicator .spinner {
  display: inline-block;
  vertical-align: middle;
}
.htmx-request .btn[type="submit"],
.btn.htmx-request {
  opacity: var(--busy);
  cursor: progress;
}
.spinner {
  flex: none;
  inline-size: var(--spinner-size);
  block-size: var(--spinner-size);
  border: var(--line-focus) solid currentColor;
  border-block-start-color: transparent;
  border-radius: var(--r-round);
  animation: spin var(--dur-spin) linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  /* Touch is in play wherever the bottom tab bar is shown: every control a
     finger meets is at least 44px tall. */
  .btn,
  .brand,
  a.chip,
  .tabs__tab,
  .segmented__item,
  .pagination__link,
  .pagination__current {
    /* at least a finger, and taller with a larger root font, as the inputs beside them are */
    min-block-size: max(var(--tap), var(--control-h));
  }
  .segmented--icons .segmented__item {
    inline-size: var(--tap);
  }
  .search input {
    block-size: max(var(--tap), var(--control-h));
    font-size: var(--fs-base);
  }
  .breadcrumb a,
  .breadcrumb [aria-current="page"] {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--tap);
  }
  /* a one-word crumb is as wide as it is tall */
  .breadcrumb a {
    min-inline-size: var(--tap);
  }
  .pagination__link,
  .pagination__current {
    min-inline-size: var(--tap);
  }
  .icon-btn {
    inline-size: max(var(--tap), var(--control-h));
    block-size: max(var(--tap), var(--control-h));
  }
  .check {
    min-block-size: var(--tap);
    font-size: var(--fs-base);
  }
  .check input {
    inline-size: var(--check-size-touch);
    block-size: var(--check-size-touch);
  }
  .pick span {
    min-block-size: var(--tap);
  }
  .bento,
  .bento--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .card--pad {
    padding: var(--sp-5) var(--sp-4);
  }
  .card--interactive:hover,
  .bento__tile:hover {
    transform: none;
  }
  .avatar--xl {
    inline-size: var(--avatar-xl-narrow);
    font-size: var(--fs-2xl-plus);
  }
  .grouped-list__row {
    gap: var(--sp-3);
    padding-inline: var(--sp-3);
  }
  .grouped-list--tiles {
    --row-inset: calc(var(--tile) + 2 * var(--sp-3));
  }
  .grouped-list--tiles .grouped-list__row {
    flex-wrap: wrap;
  }
  .grouped-list--tiles .grouped-list__aside {
    flex-basis: 100%;
    margin-block-start: calc(-1 * var(--sp-2));
    padding-inline-start: calc(var(--tile) + var(--sp-3));
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-2);
  }
  .stat {
    padding: var(--sp-4);
  }
  .stat dd {
    font-size: var(--fs-3xl);
  }
  .stat--compact {
    padding-block: var(--sp-3);
    padding-inline: calc(var(--sp-4) + var(--icon-xl) + var(--sp-3)) var(--sp-4);
  }
  .stat--compact dd {
    font-size: var(--fs-2xl);
  }
  /* half a year per row, so a day is still a square a finger can read */
  .heatmap__days {
    display: none;
  }
  .heatmap__grid {
    grid-template-columns: repeat(27, minmax(0, 1fr));
    column-gap: var(--sp-half);
    row-gap: var(--sp-8);
  }
  .heatmap__week {
    gap: var(--sp-half);
  }
  .empty {
    padding: var(--sp-10) var(--sp-4);
  }
  .page-header__title {
    font-size: var(--fs-3xl);
  }
  /* title and action share a row; the lead and the view switch go under them */
  .page-header__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title action"
      "lead lead"
      "switch switch";
    align-items: center;
    gap: 0 var(--sp-3);
  }
  .page-header__text,
  .page-header__actions {
    display: contents;
  }
  .page-header__title {
    grid-area: title;
  }
  .page-header__lead {
    grid-area: lead;
  }
  /* a header with several lines of facts (an event's days, place, organiser): each after the one before */
  .page-header__lead ~ .page-header__lead {
    grid-area: auto;
    grid-column: 1 / -1;
  }
  /* beside the title on a phone, an action is compact: the same tap height, less width */
  .page-header__actions > .btn,
  .page-header__actions > form {
    grid-area: action;
  }
  .page-header__actions .btn {
    padding-inline: var(--sp-3);
    font-size: var(--fs-md);
  }
  .page-header__actions > .segmented {
    grid-area: switch;
    display: flex;
    margin-block-start: var(--sp-4);
  }
  .page-header__actions > .segmented .segmented__item {
    flex: 1;
  }
  /* the pills run to the edges of the screen and scroll under them */
  .page-header .tabs {
    margin-inline: calc(-1 * var(--sp-4));
    margin-block-start: calc(var(--sp-4) - var(--ring-room));
    padding-inline: var(--sp-4);
    scroll-padding-inline: var(--sp-4);
  }
  .bento,
  .bento--three {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-3);
  }
  .bento__tile--plain .bento__text {
    padding-block-start: var(--sp-5);
  }
  .prose {
    gap: var(--sp-6);
    font-size: var(--fs-base);
  }
  .prose__section h2 {
    font-size: var(--fs-xl);
  }
  .bento__tile--wide {
    grid-column: auto;
  }
  .bento__visual {
    block-size: var(--bento-visual-h-narrow);
    padding: var(--sp-5) var(--sp-5) 0;
    -webkit-mask-image: linear-gradient(to bottom, var(--mask-ink) 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, var(--mask-ink) 80%, transparent 100%);
  }
  .bento__text {
    padding: var(--sp-2) var(--sp-5) var(--sp-5);
  }
  .incercard {
    inline-size: var(--incercard-w-narrow);
    padding: var(--sp-4) var(--sp-4);
  }
  .incercard__qr {
    inline-size: var(--incercard-qr-narrow);
  }
  .profile-head__top {
    gap: var(--sp-4);
  }
  .profile-head__name {
    font-size: var(--fs-2xl-plus);
  }
  .profile-head__role {
    font-size: var(--fs-base);
  }
  .profile-head__meta {
    flex-direction: column;
    gap: var(--sp-half);
    margin-block-start: var(--sp-3);
  }
  .profile-head__chips {
    margin-block-start: var(--sp-4);
  }
  /* the main action across the card, the others two to a row under it */
  .profile-head__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-block-start: var(--sp-4);
    padding-block-start: var(--sp-4);
  }
  .profile-head__actions > .btn,
  .profile-head__actions > form > .btn {
    padding-inline: var(--sp-2);
    white-space: normal;
  }
  /* the main action comes first, across the card; the others pair up under it */
  .profile-head__actions > .btn--primary,
  .profile-head__actions > form > .btn--primary {
    order: -1;
    grid-column: 1 / -1;
    min-block-size: var(--control-h-xl);
    font-size: var(--fs-lg);
  }
  .profile-head__actions > .profile-head__hint {
    order: -1;
    grid-column: 1 / -1;
  }
  /* a button of an area still to come is across the card: half of it would break its label to hold the chip */
  .profile-head__actions > .btn--soon {
    grid-column: 1 / -1;
  }
  .incercard__name {
    font-size: var(--fs-2xl);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn:active,
  .icon-btn:active,
  .segmented__item:active,
  .tabs__tab:active,
  .card--interactive:hover,
  .bento__tile:hover {
    transform: none;
  }
  .spinner {
    animation-duration: var(--dur-spin-calm) !important;
    animation-iteration-count: infinite !important;
  }
}

/* --------------------------------------------------------------------------
   Filters: the less used fields of a list's search, folded on a phone
   -------------------------------------------------------------------------- */
/* A <details>: closed on a phone unless a filter is set; [data-open-wide]
   opens it on a wide screen, where there is room for every field. */
.filters__summary {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-block-size: var(--tap);
  color: var(--text-2);
  font-weight: var(--fw-medium);
  cursor: pointer;
  list-style: none;
}
.filters__summary::-webkit-details-marker {
  display: none;
}
.filters[open] > .filters__summary {
  margin-block-end: var(--sp-3);
}

/* --------------------------------------------------------------------------
   Sections of a long public page: their rhythm, heading and lead
   -------------------------------------------------------------------------- */
.section {
  padding-block: var(--sp-16);
}
.section--tight {
  padding-block-start: var(--sp-6);
}
.section__head {
  max-inline-size: var(--prose-w);
  margin-block-end: var(--sp-8);
}
.section__title {
  font-size: var(--fs-title);
}
.section__lead {
  margin-block-start: var(--sp-2);
  color: var(--text-muted);
  font-size: var(--fs-lg-plus);
}
/* A link that sits beside a heading: «صفحه‌ی این نقش», «منشور را بخوانید» */
.section-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-block-size: var(--tap);
  color: var(--accent);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
}
.section-link:hover {
  color: var(--accent-hi);
}

/* Three figures in a row at every width: a phone has room for three short numbers */
.stats--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
/* What the figures are, said above them on a hairline: «داده‌ی نمونه» */
.stats-note {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-block-end: var(--sp-3);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: var(--lh-control);
}
.stats-note::before {
  /* a hairline that fades in toward the label at its inline end */
  content: "";
  flex: 1;
  block-size: var(--line);
  background: linear-gradient(var(--to-inline-end), transparent, var(--hairline-strong));
}
.stats-note span {
  padding-inline: var(--sp-3);
  border: var(--line) solid var(--hairline-strong);
  border-radius: var(--r-full);
  background: var(--surface-1);
  line-height: var(--lh-ui);
}

/* Tabs that scroll sideways show their edge fading out, so a person sees there is more */
.tabs--edge {
  padding-inline-end: var(--sp-8);
  -webkit-mask-image: linear-gradient(var(--to-inline-end), var(--mask-ink) 85%, transparent);
  mask-image: linear-gradient(var(--to-inline-end), var(--mask-ink) 85%, transparent);
}
/* the fade would hide the ring of the last pill: while a pill has focus there is no fade */
.tabs--edge:focus-within {
  -webkit-mask-image: none;
  mask-image: none;
}
/* Segments that wrap onto a second row instead of overflowing: links of different lengths */
.segmented--wrap {
  display: flex;
  flex-wrap: wrap;
}
.segmented--wrap .segmented__item {
  white-space: normal;
  text-align: center;
}
/* A small «به‌زودی» beside a navigation entry whose page is a coming page */
.soon-cue {
  margin-inline-start: var(--sp-1h);
  padding-inline: var(--sp-1h);
  border: var(--line) solid var(--hairline-strong);
  border-radius: var(--r-full);
  color: var(--text-muted);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  line-height: var(--lh-ui);
  white-space: nowrap;
}
/* An area still to come names its main buttons (pages/_soon_button.html): the plain button, btn--soon, with
   the neutral «به‌زودی» chip at its end, a link to the area's coming page. On a phone's two-column header it
   is across the card. Under a coming page's lead they make one row that wraps, centred as the page is. */
.soon-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}
/* The chip keeps its one line beside a label that wraps (a phone's two-column header, a menu row) */
.btn > .chip,
.side-link > .chip {
  flex: none;
}

@media (max-width: 720px) {
  .section {
    padding-block: var(--sp-12);
  }
  .section--tight {
    padding-block-start: var(--sp-4);
  }
  .section__head {
    margin-block-end: var(--sp-6);
  }
  .stats--three .stat {
    padding: var(--sp-4) var(--sp-3);
  }
  .stats--three .stat dd {
    font-size: var(--fs-2xl);
  }
  .stats--three .stat dt {
    font-size: var(--fs-sm);
  }
}

@media (max-width: 1100px) {
  /* touch: a segment that is a link is a full tap target */
  .segmented--wrap .segmented__item {
    min-block-size: var(--tap);
  }
}

@media (max-width: 720px) {
  /* Where the row cannot hold every tab, nothing is left to find by
     scrolling: the tabs wrap onto a second row, and the fading edge, which
     says "there is more this way", goes. */
  .tabs--edge {
    flex-wrap: wrap;
    overflow-x: visible;
    padding-inline-end: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* --------------------------------------------------------------------------
   Acting as a sample node: a band fixed above every page while it lasts
   -------------------------------------------------------------------------- */
/* One line of fixed height at every width, on a warning surface, so nobody
   at a stand mistakes whose account is open. The page, and everything that
   sticks to the top or scrolls to an anchor, moves down by its height
   through one token (--acting-offset, set on <html class="is-acting">). */
.is-acting {
  --acting-offset: var(--acting-banner-h);
}
.is-acting body {
  padding-block-start: var(--acting-offset);
}
.acting-banner {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: var(--z-acting);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  block-size: var(--acting-banner-h);
  padding-inline: var(--gutter);
  border-block-end: var(--line) solid var(--warn-line);
  background-color: var(--bg-raised-2);
  background-image: linear-gradient(var(--warn-soft), var(--warn-soft));
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
}
.acting-banner__text {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-inline-size: 0;
  white-space: nowrap;
}
.acting-banner__text > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.acting-banner__text .icon {
  flex: none;
  color: var(--warn);
}
.acting-banner__short {
  display: none;
}
@media (max-width: 600px) {
  .acting-banner__full {
    display: none;
  }
  .acting-banner__short {
    display: inline;
  }
}
.is-acting .topbar,
.is-acting .site-header {
  inset-block-start: var(--acting-offset);
}
@media (min-width: 1101px) {
  .is-acting .sidebar {
    inset-block-start: var(--acting-offset);
    block-size: calc(100dvh - var(--acting-offset));
  }
}
/* The styleguide shows the band in place, not fixed over the page. */
.acting-banner--specimen {
  position: static;
  border: var(--line) solid var(--warn-line);
  border-radius: var(--r-lg);
}

/* A member's own words (a topic, a name, a place, a message, a reason, a title) wrap anywhere inside
   the surface that draws them, however long a word without a space is (M2 Task 4, fix round 1, B-1).
   Set once on the shared surfaces and inherited by what they hold, so no page marks its own elements. */
.card,
.sheet,
.note,
.page-header__text,
.grouped-list__main,
.incercard__who {
  overflow-wrap: anywhere;
}
