/*
 * Components: one class per piece of interface, variants with "--",
 * inner parts with "__". Every value comes from tokens.css.
 *
 * Index
 *   Buttons ............ .btn
 *   Form controls ...... .input .select .textarea .checkbox .radio .switch .check .field .search
 *   Surfaces ........... .card .alert .divider
 *   Labels ............. .chip .badge
 *   People ............. .avatar .avatar-stack
 *   Navigation ......... .tabs .tab .breadcrumbs .pagination .stepper .page-header
 *   Data ............... .table .list .progress .skeleton .spinner
 *   Overlays ........... .modal .dropdown .toasts .toast
 *   Conversation ....... .bubble
 *   Empty state ........ .empty
 *
 * The style guide at /dev/styleguide/ shows each of them with its markup.
 */

/* ================================================================ Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: var(--control);
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--ink);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
}

.btn:hover { color: var(--ink); background: var(--line); }
.btn:active { transform: scale(0.98); }

.btn--primary { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.btn--primary:hover { background: var(--primary-strong); color: var(--on-primary); }

.btn--secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--secondary:hover { background: var(--surface-sunken); border-color: var(--muted-2); }

.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-sunken); color: var(--ink); }

.btn--dark { background: var(--ink); color: var(--surface); }
.btn--dark:hover { background: var(--ink-2); color: var(--surface); }

.btn--danger { background: var(--danger); color: var(--on-primary); font-weight: 700; }
.btn--danger:hover { background: var(--danger-strong); color: var(--on-primary); }

/* A quiet button for removing something small: red text, no fill until hovered. */
.btn--danger-ghost { background: transparent; color: var(--danger); }
.btn--danger-ghost:hover { background: var(--danger-tint); color: var(--danger-strong); }

/* The amber call to action, used on dark grounds. */
.btn--accent { background: var(--amber); color: var(--ink); font-weight: 800; }
.btn--accent:hover { background: var(--highlight); color: var(--ink); }

.btn--tint { background: var(--primary-tint); color: var(--primary-deep); font-weight: 700; }
.btn--tint:hover { background: var(--primary-line); color: var(--primary-deep); }

.btn--sm {
  position: relative;
  min-block-size: var(--control-sm);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

/* A small button looks 36 px tall; its target is 44 px, so fingers do not miss it. */
.btn--sm::before {
  content: "";
  position: absolute;
  inset: -4px 0;
}

.btn--lg {
  min-block-size: 52px;
  padding: 0 var(--space-6);
  font-size: var(--text-base);
}

.btn--pill { border-radius: var(--radius-pill); }
.btn--block { display: flex; inline-size: 100%; }

/* A button that holds only an icon. It needs an aria-label. */
.btn--icon {
  inline-size: var(--control);
  padding: 0;
  flex: none;
}

.btn--icon.btn--sm { inline-size: var(--control-sm); }
.btn--round { border-radius: 50%; }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* While HTMX waits for the server, or when a script sets aria-busy. */
.btn.htmx-request,
.htmx-request .btn[type="submit"],
.btn[aria-busy="true"] {
  pointer-events: none;
  opacity: 0.75;
}

.btn.htmx-request::after,
.htmx-request .btn[type="submit"]::after,
.btn[aria-busy="true"]::after {
  content: "";
  inline-size: 16px;
  block-size: 16px;
  border: 2px solid currentColor;
  border-block-start-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  inline-size: 20px;
  block-size: 20px;
  border: 2px solid var(--primary-line);
  border-block-start-color: var(--primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

/* ========================================================== Form controls */

.input,
.select,
.textarea {
  display: block;
  inline-size: 100%;
  min-block-size: var(--control);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-base);
  line-height: 1.6;
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--muted-2);
}

.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  border-color: var(--focus);
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

.input[dir="ltr"],
.textarea[dir="ltr"] {
  text-align: start;
}

/* A Latin field on a Persian page keeps its placeholder on the reading side. */
.input[dir="ltr"]::placeholder { text-align: end; }

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-sunken);
  color: var(--muted-2);
  cursor: not-allowed;
}

.input[readonly],
.textarea[readonly] {
  background: var(--surface-sunken);
}

.textarea {
  min-block-size: 120px;
  resize: vertical;
  line-height: var(--leading-normal);
}

.select {
  appearance: none;
  padding-inline-end: var(--space-8);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted-2) 50%),
    linear-gradient(135deg, var(--muted-2) 50%, transparent 50%);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
}

[dir="rtl"] .select {
  background-position: 14px 50%, 20px 50%;
}

.select[multiple] {
  background-image: none;
  padding-inline-end: var(--space-4);
}

input[type="file"].input {
  padding: var(--space-2);
  line-height: 1.8;
}

input[type="file"].input::file-selector-button {
  margin-inline-end: var(--space-3);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}

/* Check boxes and radio buttons are drawn here so they match the design everywhere. */
input.checkbox,
input.radio {
  appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  inline-size: 22px;
  block-size: 22px;
  margin: 0;
  border: 2px solid var(--speaker-unknown-line);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
}

input.radio { border-radius: 50%; }

input.checkbox::before,
input.radio::before {
  content: "";
  transform: scale(0);
  transition: transform var(--duration-fast) var(--ease);
}

input.checkbox::before {
  inline-size: 12px;
  block-size: 12px;
  background: var(--on-primary);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 10%, 37% 70%);
}

input.radio::before {
  inline-size: 10px;
  block-size: 10px;
  border-radius: 50%;
  background: var(--on-primary);
}

input.checkbox:checked,
input.radio:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input.checkbox:checked::before,
input.radio:checked::before {
  transform: scale(1);
}

input.checkbox:disabled,
input.radio:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* A check box or radio button with its text. The whole row is the click target. */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-block-size: var(--control);
  font-size: var(--text-body);
  cursor: pointer;
}

/* An on/off setting: <input type="checkbox" class="switch" role="switch">. */
input.switch {
  appearance: none;
  display: inline-flex;
  align-items: center;
  flex: none;
  inline-size: 46px;
  block-size: 28px;
  margin: 0;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--speaker-unknown);
  cursor: pointer;
  transition: background-color var(--duration) var(--ease);
}

input.switch::before {
  content: "";
  inline-size: 22px;
  block-size: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: margin var(--duration) var(--ease);
}

input.switch:checked { background: var(--primary); }
input.switch:checked::before { margin-inline-start: 18px; }
input.switch:disabled { opacity: 0.5; cursor: not-allowed; }

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field__label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink);
}

.field__required { color: var(--danger); }

.field__help {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.7;
}

.field__error {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--danger);
  line-height: 1.7;
}

.field__options {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-6);
}

.field--invalid .input,
.field--invalid .select,
.field--invalid .textarea,
.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

/* Fields side by side on wide screens, stacked on narrow ones. */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: var(--space-4);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* A rounded search box: <label class="search">icon <input></label>. */
.search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: var(--control);
  padding: 0 var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted-2);
  cursor: text;
}

.search:focus-within {
  border-color: var(--focus);
  outline: 2px solid var(--focus);
}

.search input {
  flex: 1;
  min-inline-size: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-md);
}

/* The ring is drawn on the whole box by :focus-within above, not on the bare input. */
.search input:focus-visible { outline-color: transparent; }

/* =============================================================== Surfaces */

.card {
  display: block;
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  min-inline-size: 0;
}

/* A card whose parts are stacked: <section class="card stack">. Said here because .card is a block. */
.card.stack { display: flex; }

.card--lg { padding: var(--space-7); border-radius: var(--radius-xl); }
.card--flat { background: transparent; }
.card--sunken { background: var(--bg); }

.card--tint,
.card--amber,
.card--sky,
.card--coral {
  border-color: transparent;
}

.card--tint { background: var(--primary-tint); }
.card--amber { background: var(--amber-tint); }
.card--sky { background: var(--sky-tint); }
.card--coral { background: var(--coral-tint); }

/* A whole card that is a link or a button. */
.card--interactive {
  cursor: pointer;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease),
    transform var(--duration) var(--ease);
}

.card--interactive:hover {
  border-color: var(--primary-line);
  box-shadow: var(--shadow-card);
  color: inherit;
  transform: translateY(-2px);
}

.card__title { font-size: var(--text-lg); font-weight: 800; overflow-wrap: anywhere; }
.card__text { color: var(--muted); font-size: var(--text-body); }

/* A message inside the page: form-wide errors, notices, warnings. */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--sky-tint);
  color: var(--sky-ink);
  font-size: var(--text-md);
  line-height: 1.8;
}

.alert > .icon { margin-block-start: 3px; }
.alert--success { background: var(--primary-tint); color: var(--primary-deep); }
.alert--warning { background: var(--amber-tint); color: var(--amber-ink); }
.alert--info { background: var(--sky-tint); color: var(--sky-ink); }
.alert--danger { background: var(--danger-tint); color: var(--danger); }

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--muted-2);
  font-size: var(--text-sm);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-block-start: 1px solid var(--line);
}

.divider--dashed::before,
.divider--dashed::after { border-block-start-style: dashed; }

/* ================================================================= Labels */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: 28px;
  padding: 2px var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  max-inline-size: 100%;
}

.chip--primary { border-color: transparent; background: var(--primary-tint); color: var(--primary-deep); }
.chip--amber { border-color: transparent; background: var(--amber-tint); color: var(--amber-ink); }
.chip--coral { border-color: transparent; background: var(--coral-tint); color: var(--coral-ink); }
.chip--sky { border-color: transparent; background: var(--sky-tint); color: var(--sky-ink); }
.chip--outline { border: 1px dashed var(--primary); background: var(--surface); color: var(--primary); }

/* A chip that can be pressed: a suggestion, a filter, a choice. */
button.chip,
a.chip {
  position: relative;
  min-block-size: var(--control-sm);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
}

/* The target is taller than the chip looks, so fingers do not miss it. */
button.chip::after,
a.chip::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}

button.chip:hover,
a.chip:hover {
  border-color: var(--muted-2);
  color: var(--ink);
}

button.chip--primary:hover,
a.chip--primary:hover { background: var(--primary-line); border-color: transparent; color: var(--primary-deep); }

.chip[aria-pressed="true"],
.chip--selected {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

/* A small count next to a label. */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.8;
}

.badge--primary { background: var(--primary); color: var(--on-primary); }
.badge--coral { background: var(--coral-tint); color: var(--coral-ink); }
.badge--amber { background: var(--amber-tint); color: var(--amber-ink); }

/* A small coloured dot: unread, recording, online. */
.dot {
  display: inline-block;
  inline-size: 9px;
  block-size: 9px;
  border-radius: 50%;
  background: var(--coral);
  flex: none;
}

/* ================================================================= People */

/* The {% avatar %} tag sets the size through the width and height attributes;
   the two size classes are for avatars written by hand. */
.avatar {
  display: inline-block;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  overflow: hidden;
  background: var(--surface-sunken);
  aspect-ratio: 1;
}

.avatar--sm { inline-size: 28px; block-size: 28px; }
.avatar--lg { inline-size: 56px; block-size: 56px; }
.avatar--ring { box-shadow: 0 0 0 2px var(--surface); }

.avatar__ground { fill: var(--avatar-ground, var(--surface-sunken)); }
.avatar__figure { fill: var(--avatar-figure, var(--muted-2)); }

.avatar--s1 { --avatar-ground: var(--speaker-1-tint); --avatar-figure: var(--speaker-1); }
.avatar--s2 { --avatar-ground: var(--speaker-2-tint); --avatar-figure: var(--speaker-2); }
.avatar--s3 { --avatar-ground: var(--speaker-3-tint); --avatar-figure: var(--speaker-3); }
.avatar--s4 { --avatar-ground: var(--speaker-4-tint); --avatar-figure: var(--speaker-4); }
.avatar--s5 { --avatar-ground: var(--speaker-5-tint); --avatar-figure: var(--speaker-5); }
.avatar--s6 { --avatar-ground: var(--speaker-6-tint); --avatar-figure: var(--speaker-6); }

/* A speaker nobody has named yet. */
.avatar--unknown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: var(--avatar-size, 40px);
  block-size: var(--avatar-size, 40px);
  border: 2px dashed var(--speaker-unknown-line);
  background: var(--surface);
  color: var(--muted-2);
  font-size: calc(var(--avatar-size, 40px) * 0.4);
  font-weight: 700;
  line-height: 1;
}

/* Overlapping faces. Each avatar after the first slides under its neighbour. */
.avatar-stack {
  display: inline-flex;
  align-items: center;
}

.avatar-stack > * + * { margin-inline-start: -10px; }
.avatar-stack > .avatar { box-shadow: 0 0 0 2px var(--surface); }

/* The name of a speaker, in the colour of their slot. */
.speaker-name { font-weight: 700; color: var(--ink-2); }
.speaker-name--s1 { color: var(--speaker-1-ink); }
.speaker-name--s2 { color: var(--speaker-2-ink); }
.speaker-name--s3 { color: var(--speaker-3-ink); }
.speaker-name--s4 { color: var(--speaker-4-ink); }
.speaker-name--s5 { color: var(--speaker-5-ink); }
.speaker-name--s6 { color: var(--speaker-6-ink); }

/* ============================================================= Navigation */

/* The row scrolls sideways on a narrow screen. The padding keeps the focus
   ring of a tab from being cut by the scrolling box; the margin takes it back. */
.tabs {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-1);
  margin: calc(var(--space-1) * -1);
  overflow-x: auto;
  scrollbar-width: none;
  font-size: var(--text-body);
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  min-block-size: var(--control);
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  color: var(--ink-2);
  white-space: nowrap;
  transition: background-color var(--duration-fast) var(--ease);
}

.tab:hover { background: var(--surface-sunken); color: var(--ink); }

.tab--active,
.tab--active:hover {
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
  color: var(--muted-2);
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-inline-size: 0;
}

.breadcrumbs a { color: var(--muted-2); }
.breadcrumbs a:hover { color: var(--ink); }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

.page-header__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-inline-size: 0;
}

.page-header__title { font-size: var(--text-3xl); overflow-wrap: anywhere; }
.page-header__subtitle { color: var(--muted); }
.page-header__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: var(--control);
  min-block-size: var(--control);
  padding: 0 var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--text-md);
  font-weight: 600;
}

a.pagination__item:hover { border-color: var(--muted-2); color: var(--ink); }

.pagination__item--current {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.pagination__gap { color: var(--muted-2); padding: 0 var(--space-1); }

/* The steps of a process, side by side with a line between them. */
.stepper {
  display: flex;
  gap: var(--space-2);
  counter-reset: step;
}

.stepper__step {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-inline-size: 0;
  position: relative;
  color: var(--muted-2);
  font-size: var(--text-sm);
  text-align: center;
}

/* The line from this step to the next one. */
.stepper__step:not(:last-child)::after {
  content: "";
  position: absolute;
  inset-block-start: 16px;
  inset-inline-start: calc(50% + 22px);
  inline-size: calc(100% - 36px);
  border-block-start: 2px solid var(--line);
}

.stepper__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 34px;
  block-size: 34px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted-2);
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.stepper__label { overflow-wrap: anywhere; }

.stepper__step--done { color: var(--ink-2); }
.stepper__step--done .stepper__mark { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.stepper__step--done:not(:last-child)::after { border-block-start-color: var(--primary); }

.stepper__step--current { color: var(--ink); font-weight: 700; }
.stepper__step--current .stepper__mark { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-tint); }

.stepper__step--failed { color: var(--danger); font-weight: 700; }
.stepper__step--failed .stepper__mark { border-color: var(--danger); background: var(--danger); color: var(--on-primary); }

/* =================================================================== Data */

/* Wrap a table in .table-wrap: on a narrow screen the table scrolls inside it, not the page. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.table {
  min-inline-size: 560px;
  font-size: var(--text-md);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: start;
  vertical-align: middle;
  border-block-end: 1px solid var(--line-soft);
}

.table th {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  white-space: nowrap;
}

/* The first column holds the name of the row and keeps a readable width. */
.table th:first-child,
.table td:first-child { min-inline-size: 200px; }

.table tbody tr:last-child td { border-block-end: 0; }
.table tbody tr:hover td { background: var(--bg); }
.table .table__number { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Rows with a border each: tasks, members, files. */
.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.list__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: inherit;
  min-inline-size: 0;
  /* A row reached by its address (…#task-…) stops below the top bar, which stays on the screen. */
  scroll-margin-block-start: calc(64px + var(--space-4));
}

a.list__item:hover { border-color: var(--primary-line); color: inherit; }

/* The row the address points at is told apart from the others. */
.list__item:target { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }

.list__body { flex: 1; min-inline-size: 0; }
.list__title { font-size: var(--text-body); font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
/* Date, length, people: short facts side by side, wrapping when there is no room. */
.list__meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--muted-2);
}

/* A fact of the row with a small icon before it: <span class="list__fact">icon text</span>. */
.list__fact { display: inline-flex; align-items: center; gap: var(--space-1); }

/* The buttons of a row stand at its end. A row marked list__item--wrap keeps a least width for
   its text, so on a phone the buttons drop to a line of their own under it. */
.list__actions { display: flex; align-items: center; gap: var(--space-1); margin-inline-start: auto; }
.list__item--wrap { flex-wrap: wrap; }
.list__item--wrap .list__body { min-inline-size: 200px; }

/* A row that needs attention: no owner, failed, overdue. */
.list__item--attention {
  border: 1px dashed var(--coral);
  background: var(--coral-soft);
}

.list__item--attention .list__meta { color: var(--coral-ink); font-weight: 600; }

/* A numbered list of short statements: decisions, steps of a guide. */
.numbered {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  counter-reset: numbered;
}

.numbered > li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  counter-increment: numbered;
  line-height: 1.85;
}

.numbered > li::before {
  content: counter(numbered, persian);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 24px;
  block-size: 24px;
  margin-block-start: 3px;
  border-radius: 8px;
  background: var(--amber-tint);
  color: var(--amber-ink);
  font-size: var(--text-sm);
  font-weight: 800;
}

/* A step that holds more than a sentence (a picture, a form) takes the rest of the row. */
.numbered > li > div,
.numbered > li > form { flex: 1; min-inline-size: 0; }

/* A label with a large value: balance, minutes used, number of meetings. */
.stat { display: flex; flex-direction: column; gap: var(--space-1); min-inline-size: 0; }
.stat__label { font-size: var(--text-sm); color: var(--muted); }
.stat__value { font-size: var(--text-2xl); font-weight: 800; line-height: 1.5; font-variant-numeric: tabular-nums; }

/* <div class="progress" role="progressbar" aria-valuenow="40" ...><span style="inline-size: 40%"></span></div> */
.progress {
  display: flex;
  block-size: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  overflow: hidden;
}

.progress > span {
  display: block;
  block-size: 100%;
  border-radius: var(--radius-pill);
  background: var(--primary);
  transition: inline-size var(--duration-slow) var(--ease);
}

.progress--coral > span { background: var(--coral); }
.progress--amber > span { background: var(--amber); }

/* A grey shape that stands in for content while it loads. */
.skeleton {
  display: block;
  min-block-size: 14px;
  border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--line-soft) 50%, var(--surface-sunken) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
}

@keyframes skeleton {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* =============================================================== Overlays */

/* A native <dialog>: the browser keeps the focus inside and closes it with Escape. */
.modal {
  inline-size: min(520px, calc(100vw - 2 * var(--space-4)));
  max-block-size: calc(100dvh - 2 * var(--space-4));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
  overflow: auto;
}

.modal--wide { inline-size: min(760px, calc(100vw - 2 * var(--space-4))); }

.modal::backdrop {
  background: var(--scrim);
}

.modal[open] { animation: rise var(--duration) var(--ease); }

.modal__box {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
}

.modal__title { font-size: var(--text-xl); }
.modal__text { color: var(--muted); }

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-block-start: var(--space-2);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* A menu that opens under a button. Alpine holds the open state. */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown__menu {
  position: absolute;
  inset-block-start: calc(100% + var(--space-2));
  inset-inline-end: 0;
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-inline-size: 220px;
  max-inline-size: min(320px, calc(100vw - 2 * var(--space-4)));
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.dropdown__menu--start { inset-inline-end: auto; inset-inline-start: 0; }

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  inline-size: 100%;
  min-block-size: var(--control);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-md);
  text-align: start;
}

.dropdown__item:hover { background: var(--surface-sunken); color: var(--ink); }
.dropdown__item--danger { color: var(--danger); }
.dropdown__item--danger:hover { background: var(--danger-tint); color: var(--danger); }

.dropdown__separator {
  margin: var(--space-1) 0;
  border-block-start: 1px solid var(--line-soft);
}

/* At the end side (the left, in Persian), so a toast never covers the side menu of the app. */
.toasts {
  position: fixed;
  inset-block-end: calc(var(--space-4) + var(--bottom-bar, 0px));
  inset-inline-end: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  inline-size: min(420px, calc(100vw - 2 * var(--space-4)));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--sky);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
  font-size: var(--text-md);
  line-height: 1.8;
  pointer-events: auto;
  animation: rise var(--duration) var(--ease);
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.toast__icon { margin-block-start: 3px; color: var(--sky-strong); }
.toast__text { flex: 1; min-inline-size: 0; overflow-wrap: anywhere; }

.toast__close {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  inline-size: 28px;
  block-size: 28px;
  margin-inline-end: calc(var(--space-2) * -1);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-2);
}

/* The cross is small; its target is 44 px. */
.toast__close::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.toast__close:hover { background: var(--surface-sunken); color: var(--ink); }

.toast--success { border-inline-start-color: var(--primary); }
.toast--success .toast__icon { color: var(--primary); }
.toast--error { border-inline-start-color: var(--danger); }
.toast--error .toast__icon { color: var(--danger); }
.toast--warning { border-inline-start-color: var(--amber); }
.toast--warning .toast__icon { color: var(--amber-ink); }
.toast--info { border-inline-start-color: var(--sky); }
.toast--leaving { opacity: 0; transform: translateY(8px); }

/* =========================================================== Conversation */

.bubble {
  max-inline-size: min(560px, 88%);
  padding: var(--space-3) var(--space-4);
  border-radius: 18px;
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  overflow-wrap: anywhere;
}

/* What the person asked: at the start side, in the primary colour. */
.bubble--mine {
  align-self: flex-start;
  border-end-start-radius: var(--radius-xs);
  background: var(--primary);
  color: var(--on-primary);
}

/* What the assistant answered: at the end side, on white. */
.bubble--theirs {
  align-self: flex-end;
  border-end-end-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.bubble__meta {
  display: block;
  margin-block-end: 2px;
  font-size: var(--text-xs);
  font-weight: 600;
  opacity: 0.8;
}

/* ============================================================ Empty state */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.empty__art { inline-size: 240px; max-inline-size: 70%; block-size: auto; }
.empty__title { font-size: var(--text-xl); }
.empty__text { max-inline-size: 44ch; color: var(--muted); }
.empty .btn { margin-block-start: var(--space-2); }

/* ========================================================== Sign-in pages */

/* A field for a short code: large, centred digits of equal width. */
.input.input--code {
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* An input with a button inside it (the eye of a password field). The wrapper
   is left-to-right, so "end" is the right side for the button and the padding. */
.input-affix {
  position: relative;
}

.input-affix .input {
  padding-inline-end: 52px;
}

.input-affix__button {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: var(--control);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted-2);
}

.input-affix__button:hover { color: var(--ink); }

/* Tabs that share the width equally (the two ways to sign in). */
.tabs--fill .tab {
  flex: 1;
  justify-content: center;
}

.code-resend { justify-content: center; }

/* ================================================================ Settings */

/* The settings pages are forms: a line of text that is too long is hard to read. */
.settings { max-inline-size: 960px; }

/* A block of settings: what it is about on one side, the form on the other.
   On narrow screens the two parts stack. */
.settings-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
}

.settings-section__intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.settings-section__body { min-inline-size: 0; }

@media (min-width: 860px) {
  .settings-section {
    grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
    gap: var(--space-7);
  }
}

/* A single card for one small task: a code to enter, the two-step setup. */
.settings-narrow { max-inline-size: 560px; }

/* The picture next to its two forms. */
.settings-avatar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-5);
}

.settings-avatar__forms {
  flex: 1 1 240px;
  min-inline-size: 0;
}

/* Email or phone number: the value, its state, and the form that changes it. */
.settings-contact {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.settings-contact__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.settings-contact__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 40px;
  block-size: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-tint);
  color: var(--primary-deep);
}

/* <details class="disclosure"><summary class="btn ...">open</summary><div class="disclosure__body">...</div></details>
   A part of the page that opens in place. The browser does the opening; no script is needed. */
.disclosure > summary {
  list-style: none;
  inline-size: fit-content;
}

.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure[open] > summary { background: var(--surface-sunken); }
.disclosure__body { margin-block-start: var(--space-4); }

/* Two-step setup: the QR picture and the key to type by hand. */
.totp-qr {
  inline-size: 200px;
  block-size: 200px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.totp-secret {
  display: inline-block;
  inline-size: fit-content;
  max-inline-size: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font-size: var(--text-md);
  font-weight: 600;
  overflow-wrap: anywhere;
  user-select: all;
}

/* =============================================================== Dashboard */

/* Two numbers side by side on a phone, four on a wide screen. */
.dashboard-stats { --grid-min: 150px; --grid-gap: var(--space-3); }
.dashboard-columns { --grid-min: 340px; align-items: start; }

/* One number of the dashboard: a coloured mark, a label and the value. */
.dashboard-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  min-inline-size: 0;
}

/* Room for the mark beside the number. */
@media (min-width: 640px) {
  .dashboard-stat {
    flex-direction: row;
    align-items: center;
    gap: var(--space-4);
  }
}

.dashboard-stat__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 48px;
  block-size: 48px;
  border-radius: var(--radius-md);
  background: var(--stat-tint);
  color: var(--stat-ink);
}

.dashboard-stat__value {
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.dashboard-stat--primary { --stat-tint: var(--primary-tint); --stat-ink: var(--primary-deep); }
.dashboard-stat--amber { --stat-tint: var(--amber-tint); --stat-ink: var(--amber-ink); }
.dashboard-stat--coral { --stat-tint: var(--coral-tint); --stat-ink: var(--coral-ink); }
.dashboard-stat--sky { --stat-tint: var(--sky-tint); --stat-ink: var(--sky-ink); }
/* The balance beside the numbers: a link to the wallet. Its value is an amount with its unit, so a size smaller. */
.dashboard-stat--wallet { --stat-tint: var(--primary-tint); --stat-ink: var(--primary-deep); color: inherit; text-decoration: none; }
/* A large balance breaks between the number and its unit, never out of the card. */
.dashboard-stat--wallet .dashboard-stat__value { font-size: var(--text-lg); line-height: 1.6; }

/* The small coloured square at the start of a dashboard row. */
.dashboard-mark {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 36px;
  block-size: 36px;
  border-radius: var(--radius-sm);
}

.dashboard-mark--primary { background: var(--primary-tint); color: var(--primary-deep); }
.dashboard-mark--coral { background: var(--coral-tint); color: var(--coral-ink); }

/* ============================================================== File field */

/* components/file_field.html: our own button and file name; the browser's control stays
   in the page (so the keyboard and screen readers reach it) but takes no room. */
.file-field {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.file-field input[type="file"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}

.file-field input[type="file"]:focus-visible + .file-field__button {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.file-field__name {
  min-inline-size: 0;
  font-size: var(--text-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ================================================================= Notices */

/* The notification centre keeps its lines short enough to read. */
.notices { max-inline-size: 860px; }

/* A notice is a .list__item; one that was not read yet stands out. */
.notice { align-items: flex-start; }
.notice--unread { border-color: var(--primary-line); background: var(--primary-tint); }
.notice__text { color: var(--ink-2); font-size: var(--text-md); line-height: 1.9; overflow-wrap: anywhere; }

.notice__mark {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 36px;
  block-size: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.notice__mark--primary { background: var(--primary-tint); color: var(--primary-deep); }
.notice__mark--sky { background: var(--sky-tint); color: var(--sky-ink); }
.notice__mark--coral { background: var(--coral-tint); color: var(--coral-ink); }
.notice__mark--amber { background: var(--amber-tint); color: var(--amber-ink); }
.notice--unread .notice__mark { box-shadow: 0 0 0 2px var(--surface); }

/* ============================================================ Organization */

.org-grid { --grid-min: 280px; }

/* A card for one organization: its logo and name, a line about it, three counts. */
.org-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  color: inherit;
}

.org-card__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-inline-size: 0;
}

.org-card__head .card__title { overflow-wrap: anywhere; }

/* The top of an organization's own page: the logo beside the text. */
.org-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-5);
}

.org-summary__text { flex: 1 1 260px; min-inline-size: 0; }

/* A form that is too wide to read as one column of full-width fields. */
.form-wide { max-inline-size: 860px; }

/* The filters above a list: fields side by side, the buttons at the end. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.filter-bar__field {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-inline-size: 0;
}

.filter-bar__actions {
  display: flex;
  gap: var(--space-2);
}

/* Facts about one thing, as label and value pairs: <dl class="facts"><div><dt>…</dt><dd>…</dd></div>…</dl> */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--space-4);
  margin: 0;
}

.facts dt { font-size: var(--text-sm); color: var(--muted-2); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.facts__wide { grid-column: 1 / -1; }
.facts__wide dd { font-weight: 400; line-height: 1.9; }

/* A signature: shown on a light ground whatever the picture's own transparency. */
.signature {
  max-inline-size: min(320px, 100%);
  block-size: auto;
  padding: var(--space-3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

/* =============================================================== Recorder */

/* components/recorder.html: the row of buttons, the clock, and the player of what was recorded. */
.recorder { display: flex; flex-direction: column; gap: var(--space-2); }

.recorder__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.recorder__row audio { max-inline-size: 100%; }

/* The red dot that says "recording now". It only blinks for people who have not asked for less motion. */
.recorder__live {
  inline-size: 10px;
  block-size: 10px;
  border-radius: 50%;
  background: var(--danger);
}

@media (prefers-reduced-motion: no-preference) {
  .recorder__live { animation: recorder-live 1.2s ease-in-out infinite; }
}

@keyframes recorder-live {
  50% { opacity: 0.25; }
}

/* While the recording is paused the dot rests: grey, and still. */
.recorder__live--paused { background: var(--muted-2); animation: none; }

/* The live picture of the sound. The script draws bars in this element's colour. */
.recorder__meter {
  flex: 1;
  min-inline-size: 120px;
  max-inline-size: 240px;
  block-size: 40px;
  color: var(--primary);
}

/* A stored voice sample in the list: its player sits under the state and the date. */
.voice-sample { align-items: flex-start; }
.voice-sample__player { inline-size: 100%; max-inline-size: 360px; margin-block-start: var(--space-2); }

/* =============================================================== Uploader */

/* templates/meeting/_audio_step.html: the area files are dropped on, and the queue of files on their way.
   The behaviour is in static/js/uploader.js. */
.uploader { display: flex; flex-direction: column; gap: var(--space-3); }

.uploader__drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  transition: border-color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease);
}

/* While a file is held over the form. */
.uploader--over .uploader__drop { border-color: var(--primary); background: var(--primary-tint); }

.uploader__text { flex: 1; min-inline-size: 220px; }
.uploader__title { margin: 0; font-weight: 600; color: var(--ink); }
.uploader__text .field__help { margin-block-start: var(--space-1); }

.uploader__choose {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* The browser's own file control stays in the page for the keyboard and for screen readers, but is not
   drawn: our button (its label) opens it. */
.uploader__choose input[type="file"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}

.uploader__choose input[type="file"]:focus-visible + .uploader__button {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* With scripts off nothing would show which files were chosen, so there the browser's own control is
   drawn (it names them) and our button steps aside. */
@media (scripting: none) {
  .uploader__choose input[type="file"] {
    position: static;
    inline-size: auto;
    block-size: auto;
    margin: 0;
    overflow: visible;
    clip-path: none;
  }

  .uploader__button { display: none; }
}

.uploader__files {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* One file of the queue: its name and size, then its progress bar or the reason it failed. */
.uploader__file {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.uploader__file--failed { border-color: var(--coral-soft); background: var(--coral-tint); }

.uploader__line { display: flex; align-items: center; gap: var(--space-3); min-block-size: var(--control-sm); }
.uploader__name { flex: 1; min-inline-size: 0; font-weight: 600; overflow-wrap: anywhere; }
.uploader__size { flex: none; font-size: var(--text-sm); color: var(--muted); }
.uploader__file .field__error { margin: 0; }

/* The name of a refused file, above the reason, when the form was sent with scripts off. */
.upload-refusal__name { display: block; overflow-wrap: anywhere; }

/* A list without marks, for short lines inside a message. */
.plain-list { margin: 0; padding: 0; list-style: none; }

/* The browser's own progress bar: <progress class="progress" max="100" value="40">. The selectors name
   the element, so that these rules do not reach the drawn bar above (<div class="progress"><span>). */
progress.progress {
  display: block;
  inline-size: 100%;
  block-size: 6px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--line-soft);
  color: var(--primary);
  accent-color: var(--primary);
  appearance: none;
}

progress.progress::-webkit-progress-bar { border-radius: var(--radius-pill); background: var(--line-soft); }
progress.progress::-webkit-progress-value { border-radius: var(--radius-pill); background: var(--primary); transition: inline-size var(--duration) var(--ease); }
progress.progress::-moz-progress-bar { border-radius: var(--radius-pill); background: var(--primary); }

/* ============================================================== Recordings */

/* templates/meeting/_recordings.html: one recording of a meeting is a .list__item. Its player sits under
   its name; the owner's buttons stand at the end and drop under the text on a narrow screen. */
.recording { align-items: flex-start; flex-wrap: wrap; }
.recording .list__body { min-inline-size: 200px; }
.recording__player { inline-size: 100%; max-inline-size: 420px; margin-block-start: var(--space-2); }

.recording__actions { display: flex; align-items: center; gap: var(--space-1); margin-inline-start: auto; }
.recording__order { display: flex; align-items: center; gap: var(--space-1); }

/* ================================================================= Minutes */

/* templates/meeting/minutes.html: the minutes, section by section. */
.minutes__section { display: flex; flex-direction: column; gap: var(--space-3); padding-block-start: var(--space-4); border-block-start: 1px solid var(--line-soft); }
.minutes__heading { margin: 0; font-size: var(--text-md); font-weight: 700; color: var(--ink); }
.minutes__text { margin: 0; line-height: var(--leading-loose); color: var(--ink-2); overflow-wrap: anywhere; }

/* templates/meeting/minutes_form.html: the rows of a list section, a title beside its description. */
.minutes-form { max-inline-size: 860px; }
.minutes-items { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; border: 0; min-inline-size: 0; }
.minutes-items__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-3); align-items: start; }

@media (max-width: 640px) {
  .minutes-items__row { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding-block-end: var(--space-3); border-block-end: 1px solid var(--line-soft); }
}

/* ======================================================= Minutes templates */

/* templates/meeting/templates.html: a card for each template, a few to a row. The buttons of a card
   stay at its foot, however long its description is. */
.template-grid { --grid-min: 320px; align-items: stretch; }
.template-card { min-inline-size: 0; }
.template-card .card__title { overflow-wrap: anywhere; }
.template-card__sections { margin: 0; padding: 0; list-style: none; gap: var(--space-2); }
.template-card__actions { margin-block-start: auto; padding-block-start: var(--space-3); border-block-start: 1px solid var(--line-soft); gap: var(--space-2); }

/* templates/meeting/template_form.html: the sections of a template, one bordered row each, in the
   order the minutes are written in. */
.template-form { max-inline-size: 860px; }
.template-sections { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }

.template-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

/* An empty row waiting for a new section looks like an offer, not like a section. */
.template-section--new { border-style: dashed; background: var(--bg); }

.template-section__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
/* The title takes the width, the place a narrow column beside it; one under the other on a phone. */
.template-section__fields { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: var(--space-3); align-items: start; }

@media (max-width: 520px) {
  .template-section__fields { grid-template-columns: minmax(0, 1fr); }
}

/* ============================================================== Transcript */

/* templates/meeting/_transcript_recording.html: one recording with its player and its turns.
   The behaviour of the player is in static/js/player.js. */
.transcript__audio { inline-size: 100%; }
/* Once our own player is drawn, the browser's element has no controls and takes no room. */
.transcript__audio:not([controls]) { display: none; }

.player { display: flex; align-items: center; gap: var(--space-3); }
.player__play { flex: none; }
.player__clock { flex: none; font-size: var(--text-sm); color: var(--ink-2); }
.player__speed { flex: none; min-inline-size: 3.5em; }

/* The bar: a piece for each turn in its speaker's colour, the part already heard a little darker,
   and a mark where the sound is. It is also what is pressed to go to a moment. */
.player__bar {
  flex: 1;
  min-inline-size: 80px;
  block-size: var(--control-sm);
  padding-block: var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.player__bar:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

/* On a phone the bar gets a line of its own under the buttons, so a finger can find a moment on it. */
@media (max-width: 520px) {
  .player { flex-wrap: wrap; }
  .player__clock { flex: 1; }
  .player__bar { order: 1; flex-basis: 100%; }
}

.player__pieces {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  border-radius: var(--radius-pill);
  background: var(--line-soft);
}

.speaker-fill { fill: var(--speaker-unknown); }
.speaker-fill--s1 { fill: var(--speaker-1); }
.speaker-fill--s2 { fill: var(--speaker-2); }
.speaker-fill--s3 { fill: var(--speaker-3); }
.speaker-fill--s4 { fill: var(--speaker-4); }
.speaker-fill--s5 { fill: var(--speaker-5); }
.speaker-fill--s6 { fill: var(--speaker-6); }
.player__played { fill: var(--ink); opacity: 0.22; }
.player__head { fill: var(--ink); }

/* Who speaks in the recording: a dot of each speaker's colour and the name. */
.transcript__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.transcript__legend li { display: inline-flex; align-items: center; gap: var(--space-2); }
.speaker-dot--s1 { background: var(--speaker-1); }
.speaker-dot--s2 { background: var(--speaker-2); }
.speaker-dot--s3 { background: var(--speaker-3); }
.speaker-dot--s4 { background: var(--speaker-4); }
.speaker-dot--s5 { background: var(--speaker-5); }
.speaker-dot--s6 { background: var(--speaker-6); }

.transcript__turns {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* One turn: who spoke and when, then what was said. The one being heard stands out. */
.turn {
  padding: var(--space-3) var(--space-4);
  border-inline-start: 3px solid transparent;
  border-radius: var(--radius-md);
}

.turn--now { border-inline-start-color: var(--primary); background: var(--primary-tint); }
.turn__head { display: flex; align-items: center; gap: var(--space-3); }
.turn__text { margin: 0; line-height: var(--leading-loose); color: var(--ink); overflow-wrap: anywhere; }

/* The time of a turn is a button: pressing it plays from there. Its target is taller than it looks. */
.turn__time {
  position: relative;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--muted);
  cursor: pointer;
}

.turn__time::before { content: ""; position: absolute; inset: -12px -6px; }
.turn__time:hover { background: var(--surface-sunken); color: var(--primary-deep); }
.turn__time:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.turn__time--plain { cursor: default; }
.turn__time--plain::before { content: none; }
.turn__time--plain:hover { background: none; color: var(--muted); }

/* ================================================================ Speakers */

/* templates/meeting/_speakers.html: one block for each voice of a meeting. A voice nobody named yet has
   its sample, a few things it said, and the form that says who it is. */
.speakers {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.speakers__title { margin: 0; font-size: var(--text-md); font-weight: 700; color: var(--ink); }

.speaker {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

/* A voice that has its name is a quiet row; the form opens under it when "correct" is pressed. */
.speaker--named { gap: var(--space-2); padding: var(--space-3) var(--space-4); }

.speaker__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.speaker__who { display: flex; flex-direction: column; flex: 1; min-inline-size: 140px; }
.speaker__name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.speaker__sample { inline-size: 100%; max-inline-size: 320px; }

/* What the voice said: each line begins with the moment it was said. */
.speaker__said {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  list-style: none;
  font-size: var(--text-sm);
  line-height: var(--leading-loose);
  color: var(--ink-2);
}

.speaker__said li { display: flex; align-items: baseline; gap: var(--space-3); }
.speaker__said q { quotes: none; overflow-wrap: anywhere; }
.speaker__time { flex: none; color: var(--muted); }

.speaker__form { display: flex; flex-direction: column; gap: var(--space-3); }

/* The choice and its two buttons in one row; the buttons line up with the select, not with its label. */
.speaker__choice { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.speaker__choice .field { flex: 1; min-inline-size: 220px; }
.speaker__choice .field--invalid ~ .btn { align-self: center; }

/* ================================================================ Estimate */

/* templates/meeting/_estimate.html: the two processing paths as cards to choose from, and the start button. */
.estimate {
  padding-block-start: var(--space-5);
  border-block-start: 1px solid var(--line);
}

/* The place of the estimate while nothing waits: on the page (it fills itself when a file arrives),
   but taking no room in the card. */
.estimate-slot:empty { display: none; }

.estimate__title { margin: 0; font-size: var(--text-md); font-weight: 700; color: var(--ink); }
.estimate__note { flex: 1; min-inline-size: 240px; margin: 0; }

.paths {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  border: 0;
}

/* One path: the whole card is the click target of its radio button. */
.path {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease);
}

.path:hover { border-color: var(--line-strong); }
.path:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.path:has(input:focus-visible) { outline: var(--focus-ring); outline-offset: 2px; }
.path .radio { flex: none; margin-block-start: 3px; }

/* A path this installation cannot run. */
.path--off { cursor: not-allowed; background: var(--surface-sunken); color: var(--muted); }
.path--off:hover { border-color: var(--line); }

.path__body { display: flex; flex-direction: column; gap: var(--space-2); min-inline-size: 0; }
.path__name { font-weight: 700; color: var(--ink); }
.path--off .path__name { color: var(--muted); }
.path__about { font-size: var(--text-sm); line-height: var(--leading-loose); color: var(--ink-2); }

.path__facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: var(--text-sm); color: var(--ink-2); }
.path__facts > span { display: inline-flex; align-items: center; gap: var(--space-1); }
.path__facts strong { color: var(--ink); }

/* A small picture of what the choice gives (the first page of a PDF template). */
.path__preview { inline-size: 120px; block-size: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }

/* What stands in the way of this path: the wallet is short, or the path is not set up. */
.path__short { display: inline-flex; align-items: flex-start; gap: var(--space-1); font-size: var(--text-sm); font-weight: 600; color: var(--coral-ink); }
.path__short > .icon { flex: none; margin-block-start: 3px; }

/* ================================================================= Wallet */

/* The home of the wallet: the balance beside the form to pay in, then two columns of rows and use. */
.wallet-top { --grid-min: 320px; align-items: stretch; }
.wallet-columns { --grid-min: 340px; align-items: start; }

/* Where the wallet stands. The same two circles as the card at the foot of the side menu. */
.wallet-balance {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--primary-tint);
  border-color: var(--primary-line);
  overflow: hidden;
}

.wallet-balance::before,
.wallet-balance::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.wallet-balance::before {
  inset-block-start: -34px;
  inset-inline-end: -34px;
  inline-size: 132px;
  block-size: 132px;
  background: var(--amber);
}

.wallet-balance::after {
  inset-block-start: 58px;
  inset-inline-end: 74px;
  inline-size: 40px;
  block-size: 40px;
  background: var(--coral);
}

.wallet-balance > * { position: relative; z-index: 1; }

.wallet-balance__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 44px;
  block-size: 44px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--primary-deep);
}

.wallet-balance__label { margin: 0; font-size: var(--text-md); font-weight: 600; color: var(--primary-deep); }

.wallet-balance__value {
  font-size: var(--text-4xl);
  font-weight: 800;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wallet-balance__facts,
.payment-state__facts {
  display: grid;
  gap: var(--space-2);
  margin: 0;
}

.wallet-balance__facts > div,
.payment-state__facts > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
}

.wallet-balance__facts dt,
.payment-state__facts dt { color: var(--muted-2); font-size: var(--text-md); }

.wallet-balance__facts dd,
.payment-state__facts dd { margin: 0; min-inline-size: 0; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* An amount, a code or a number stays on one line; names and addresses wrap. */
.wallet-balance__facts dd bdi,
.payment-state__facts dd bdi { white-space: nowrap; }

.wallet-balance__facts { padding-block-start: var(--space-3); border-block-start: 1px solid var(--primary-line); }
.wallet-balance__note { margin: 0; font-size: var(--text-sm); color: var(--primary-deep); }

.wallet-presets { gap: var(--space-2); }
.wallet-presets .chip { text-decoration: none; cursor: pointer; }

/* One row of the ledger: a mark, what it was, and its amount at the far end. */
.ledger-row { align-items: center; }

.ledger-row__mark {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 40px;
  block-size: 40px;
  border-radius: var(--radius-sm);
}

.ledger-row__mark--in { background: var(--primary-tint); color: var(--primary-deep); }
.ledger-row__mark--out { background: var(--surface-sunken); color: var(--muted-2); }

.ledger-row__amount {
  flex: none;
  margin-inline-start: auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger-row__amount--in { color: var(--primary-strong); }
.ledger-row__amount--void { color: var(--muted-2); font-weight: 500; text-decoration: line-through; }
.ledger-row__amount--waiting { color: var(--muted-2); font-weight: 500; }
/* A long title, meeting name or reason wraps inside the row. Only the time stays on one line (and the amount, above). */
.ledger-row .list__body { min-inline-size: 0; }
.ledger-row__note { overflow-wrap: anywhere; }
.ledger-row__when { white-space: nowrap; }

/* This month's use: the total, then each kind of work with a bar of its share. */
.wallet-month__total { margin: 0; font-size: var(--text-2xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.wallet-kinds { margin: 0; padding: 0; list-style: none; }
.wallet-kind { display: grid; gap: var(--space-1); font-size: var(--text-md); }
.wallet-kind strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wallet-kind__count { margin-inline-start: var(--space-1); font-size: var(--text-sm); color: var(--muted-2); white-space: nowrap; }

/* The page of one payment. */
.payment-page { max-inline-size: 560px; margin-inline: auto; inline-size: 100%; }
.payment-state { align-items: stretch; text-align: start; }

.payment-state__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  inline-size: 64px;
  block-size: 64px;
  border-radius: 50%;
}

.payment-state--paid .payment-state__mark { background: var(--primary-tint); color: var(--primary-deep); }
.payment-state--pending .payment-state__mark { background: var(--amber-tint); color: var(--amber-ink); }
.payment-state--failed .payment-state__mark { background: var(--danger-tint); color: var(--danger); }

.payment-state__title { margin: 0; font-size: var(--text-xl); font-weight: 800; }
.payment-state__facts { padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-sunken); }
.payment-state__code { font-variant-numeric: tabular-nums; }

/* The receipt of one row of the ledger: a narrow column, the amount large. */
.receipt { display: grid; gap: var(--space-5); max-inline-size: 640px; margin-inline: auto; inline-size: 100%; }

.receipt__amount {
  margin: 0;
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.receipt__amount--in { color: var(--primary-strong); }
.receipt__reason { white-space: normal; font-weight: 600; }

/* Three short columns: no need for the sideways scroll of wide tables on a phone. */
.receipt__table { min-inline-size: 0; inline-size: 100%; }
.receipt__table th:first-child,
.receipt__table td:first-child { min-inline-size: 0; }
.receipt__table tfoot th,
.receipt__table tfoot td { border-block-start: 1px solid var(--line); border-block-end: 0; background: var(--bg); }

/* The periods above the usage page: three to pick, and the days the page is about. */
.usage-periods { align-items: center; gap: var(--space-2); }
.usage-periods .chip { text-decoration: none; }
.usage-periods__range { margin-inline-start: var(--space-2); font-size: var(--text-sm); color: var(--muted-2); }

/* Invoice details: the form, and beside it (below it on a phone) the way to the invoices. */
.billing-columns { display: grid; gap: var(--space-5); align-items: start; }

@media (min-width: 900px) {
  .billing-columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

.billing-company {
  margin: 0;
  padding: var(--space-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  min-inline-size: 0;
}

.billing-company > legend { padding-inline: var(--space-2); }

/* The calculator: a length, and each path with what it would cost. */
.calculator__form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.calculator__form .field { flex: 1 1 180px; max-inline-size: 260px; }
.calculator__paths { --grid-min: 240px; --grid-gap: var(--space-3); }

.calculator__path {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.calculator__path--off { background: var(--surface-sunken); color: var(--muted); }
.calculator__cost { font-size: var(--text-xl); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calculator__path .list__meta > span { display: inline-flex; align-items: center; gap: var(--space-1); }

/* ================================================================ Questions */

/* templates/meeting/_questions.html: the conversations beside the open one's thread. They stand under each
   other until the page is wide enough for both beside the app's own side menu (which is fixed from 900px):
   below that the thread would be left a column too narrow to read in. */
.questions { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
@media (max-width: 1180px) { .questions { grid-template-columns: minmax(0, 1fr); } }

.questions__conversations { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-1); }
/* Above the thread the list never pushes it off the screen: past a few rows it scrolls inside itself. */
@media (max-width: 1180px) { .questions__conversations { max-block-size: 13rem; overflow-y: auto; } }

.questions__conversation {
  display: flex;
  align-items: center;
  min-block-size: 44px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.questions__conversation:hover { background: var(--surface-sunken); }
.questions__conversation--active { background: var(--primary-tint); color: var(--primary-deep); font-weight: 700; }

.questions__entries { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-5); }
.questions__versions { margin: var(--space-2) 0 0; padding-inline-start: var(--space-5); display: grid; gap: var(--space-3); color: var(--muted); }

/* A question is the person's: it stands at the start of the line in a tinted box. The answer is plain text under it. */
.question {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--primary-tint);
  max-inline-size: 640px;
}

.question__text { margin: 0; font-weight: 600; line-height: 1.9; overflow-wrap: anywhere; }
/* A fold's own line is tall enough for a finger (44px), whatever the size of its words. */
.question__more > summary { cursor: pointer; font-size: var(--text-sm); color: var(--muted); inline-size: fit-content; min-block-size: 44px; align-content: center; }
.question__more > form, .question__more > ul, .question__more > ol { margin-block-start: var(--space-2); }

.answer { display: grid; gap: var(--space-2); padding-inline-start: var(--space-4); border-inline-start: 3px solid var(--line); }
.answer__text { margin: 0; line-height: 2; overflow-wrap: anywhere; }
.answer--waiting { display: flex; align-items: center; gap: var(--space-2); color: var(--muted); }
.answer__sources { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); font-size: var(--text-sm); color: var(--muted); }
.answer__sources li { display: grid; gap: var(--space-1); overflow-wrap: anywhere; }

.questions__ask { padding-block-start: var(--space-4); border-block-start: 1px solid var(--line); }
.questions__cost { margin: 0; flex: 1 1 240px; }
.questions__rename[open] { flex: 0 0 100%; }
.questions__rename > summary { list-style: none; cursor: pointer; }
.questions__rename > summary::-webkit-details-marker { display: none; }
.questions__rename > form { margin-block-start: var(--space-3); }

/* ================================================================ Assistant */

/* templates/assistant/_assistant.html uses the classes of "Questions" above; these are the pieces only it has. */

/* What a question's search was narrowed by, as small labels under the question. */
.questions__chips { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1); }
/* A long name (a meeting's title) wraps inside its chip: it never pushes the page sideways on a phone. */
.questions__chip { font-size: var(--text-xs); max-inline-size: 100%; white-space: normal; overflow-wrap: anywhere; }

/* The fold "narrow the search": lists of check boxes side by side, under each other on a phone. */
.assistant-narrow > summary { display: inline-flex; align-items: center; gap: var(--space-2); }
.assistant-narrow__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); margin-block-start: var(--space-3); }
.assistant-narrow__fields .field__options { max-block-size: 11rem; overflow-y: auto; }

/* A question the assistant asked back: its options, then the buttons. */
.assistant-reply { padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }

/* Several answers that were found, side by side; under each other when there is no room. */
.assistant-candidates { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.assistant-candidate { display: grid; gap: var(--space-2); align-content: start; padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow-wrap: anywhere; }
.assistant-candidate p { margin: 0; line-height: 1.9; }
.assistant-candidate__meetings { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-1); font-size: var(--text-sm); }
.assistant-candidate__meetings li { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Where a source came from: the meeting, what kind of text it is, the day, who said it. */
.assistant-source__from { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; }

/* Suggested next questions: buttons that ask them. */
.assistant-follow-ups { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* A chip that is a button already has its 44px to press (button.chip::after); a long suggestion wraps instead of running off. */
.assistant-follow-up { text-align: start; white-space: normal; }

/* ================================================================== Sharing */

/* templates/sharing/_panel.html: the share panel of a meeting, in a dialog and as a page. */
.share-panel { gap: var(--space-6); }
.share-panel__title { font-size: var(--text-md); font-weight: 700; }
.share-panel__subtitle { font-size: var(--text-sm); font-weight: 600; color: var(--muted); margin-block-start: var(--space-2); }

/* One person or one waiting invitation: who, then the controls at the far end. */
.share-row { align-items: center; }
.share-row .list__body { min-inline-size: 140px; }
.share-row form { flex: none; }
.share-row__level { display: flex; align-items: center; gap: var(--space-2); }
.share-row__level .select { inline-size: auto; min-inline-size: 110px; }

/* A form of two fields and a button on one line; the fields stack on a phone. */
.share-panel__inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.share-panel__inline .field { flex: 1 1 180px; }
.share-panel__inline .form-errors { flex: 0 0 100%; }

/* One public link: its name and state, what it shows, its address, and its two actions. */
.share-links { margin: 0; padding: 0; list-style: none; }

.share-link {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.share-link--closed { background: var(--surface-sunken); }
.share-link__address { display: flex; gap: var(--space-2); align-items: center; }
.share-link__address .input { flex: 1; min-inline-size: 0; font-size: var(--text-sm); }

/* "Change" and "new link" open a form under their own button (a <details>). */
.share-link__edit > summary,
.share-panel__new > summary { list-style: none; cursor: pointer; inline-size: fit-content; }
.share-link__edit > summary::-webkit-details-marker,
.share-panel__new > summary::-webkit-details-marker { display: none; }
.share-link__edit[open],
.share-panel__new[open] { flex: 0 0 100%; }
.share-link__edit > form,
.share-panel__new > form { margin-block-start: var(--space-3); }

/* templates/sharing/_invitation_row.html and invitation.html: the words a sender wrote, and the page's first sentence. */
.invitation-message {
  margin: var(--space-2) 0 0;
  padding-inline-start: var(--space-3);
  border-inline-start: 3px solid var(--line);
  font-size: var(--text-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.invitation-lead { font-size: var(--text-md); line-height: 1.9; overflow-wrap: anywhere; }

/* ============================================================== Date picker */

/* components/date_field.html: a text field for a Jalali date with a calendar that opens under it.
   The calendar reads from right to left like the page: the week starts with Saturday at the right. */

/* A date with a time beside it: the two sit in one row and stack on a narrow screen. */
.date-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.date-row > .date-field { flex: 2 1 200px; }
.date-row__time { flex: 1 1 120px; }

/* The small label of the second field in a row ("ساعت"). */
.field__label--sub {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
}

.date-field {
  position: relative;
  display: flex;
}

/* Room for the calendar button that sits on the field. The date is typed from left to right
   (dir="ltr" in the template) on a page that reads from right to left, so the button, at the
   page's end of the field, is over the START of the text: the room is kept on that side, and
   the date is set on the reading side, where its placeholder is. (Two classes, so that this
   wins over the rule for every left-to-right field, which sets its text at its own start.) */
.input.date-field__input {
  padding-inline-start: calc(var(--control) + var(--space-1));
  text-align: end;
}

.date-field__button {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  color: var(--muted);
}

.date-picker {
  position: absolute;
  inset-block-start: calc(100% + var(--space-2));
  inset-inline-start: 0;
  z-index: var(--z-overlay);
  inline-size: min(320px, calc(100vw - 2 * var(--space-4)));
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

/* In a dialog the calendar is part of the form, under its field: a dialog scrolls what does
   not fit, so a calendar floating over the form would be cut off at the dialog's edge. */
.modal .date-field { flex-wrap: wrap; }

.modal .date-picker {
  position: static;
  flex: 0 0 100%;
  inline-size: auto;
  min-inline-size: 0;
  margin-block-start: var(--space-2);
  box-shadow: none;
}

.date-picker__head,
.date-picker__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.date-picker__title {
  font-weight: 700;
  color: var(--ink);
}

.date-picker__steps { display: inline-flex; }

/* Two small arrows side by side: a year, where one arrow is a month. */
.date-picker__double { display: inline-flex; }
.date-picker__double > .icon + .icon { margin-inline-start: -8px; }

.date-picker__week,
.date-picker__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-block-start: var(--space-2);
}

.date-picker__week {
  font-size: var(--text-xs);
  color: var(--muted-2);
  text-align: center;
}

.date-picker__day {
  aspect-ratio: 1;
  min-block-size: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.date-picker__day:hover { background: var(--surface-sunken); color: var(--ink); }
/* The places before the first day of the month keep their room, so day 1 stands under its weekday. */
.date-picker__day--empty { visibility: hidden; }
.date-picker__day--today { box-shadow: inset 0 0 0 1px var(--primary-line); color: var(--primary-deep); font-weight: 700; }
.date-picker__day--chosen,
.date-picker__day--chosen:hover { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.date-picker__foot { margin-block-start: var(--space-2); padding-block-start: var(--space-2); border-block-start: 1px solid var(--line-soft); }

/* ================================================================= Meetings */

/* The search box of a filter bar takes the room the other fields leave. */
.filter-bar__field--wide { flex: 3 1 260px; }

/* The filters that are not needed every time, folded away under one line. */
.filter-more__summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: var(--control);
  color: var(--primary-deep);
  font-size: var(--text-md);
  font-weight: 600;
  cursor: pointer;
}

.filter-more__body { padding-block-start: var(--space-2); }

/* One meeting in the list: its facts, the faces of its people, and its chips at the end.
   On a narrow screen the faces and the chips drop under the title. */
.meeting-row { flex-wrap: wrap; row-gap: var(--space-2); }
.meeting-row .list__body { flex: 1 1 240px; }

.meeting-row__people,
.meeting-row__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* components/people_picker.html: the people of a meeting, as two lists of check boxes. */
.people-picker { display: flex; flex-direction: column; gap: var(--space-3); min-inline-size: 0; }

.people-picker__chosen,
.people-picker__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.people-picker__search { flex: 1 1 220px; }

/* The cross on the chip of a chosen person. Its target is larger than it looks. */
.people-picker__remove {
  display: inline-grid;
  place-items: center;
  inline-size: 24px;
  block-size: 24px;
  margin-inline-end: -6px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.people-picker__remove:hover { background: var(--primary-line); }

/* Employees and guests side by side on a wide screen, one under the other on a narrow one. */
.people-picker__groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}

.people-picker__title {
  margin-block-end: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--muted);
}

/* A long list scrolls inside its own box, so the form's buttons stay within reach. */
.people-picker__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-block-size: 280px;
  overflow-y: auto;
  padding: var(--space-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

/* "Nobody yet" is the first item of the list and shows only while it is alone: a row that
   arrives (from the page, or from the "new person" dialog) hides it. */
.people-picker__empty { padding: var(--space-2); font-size: var(--text-sm); color: var(--muted-2); }
.people-picker__empty:not(:only-child) { display: none; }

.people-picker__label {
  inline-size: 100%;
  min-block-size: var(--control);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.people-picker__label:hover { background: var(--surface-sunken); }
.people-picker__text { display: flex; flex-direction: column; min-inline-size: 0; line-height: 1.5; }
.people-picker__name { font-weight: 600; overflow-wrap: anywhere; }
.people-picker__about { font-size: var(--text-sm); color: var(--muted-2); }

/* The people of a meeting on its page: a face, a name and a line, a few to a row. */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: var(--space-3);
}

.people-grid__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-inline-size: 0;
}

.people-grid__text { display: flex; flex-direction: column; flex: 1; min-inline-size: 0; line-height: 1.6; }
.people-grid__name { font-weight: 600; overflow-wrap: anywhere; }
.people-grid__about { font-size: var(--text-sm); color: var(--muted-2); }
