/* ==================================================================================================
   People — auth, onboarding, invitations, settings, people directory, teams. Owner: people agent.
   Scoped under page roots: .people-auth (body of auth pages), .people-settings, .people-page,
   .person-page, .teams-page, .team-page, plus modal bodies (.invite-form, .delete-confirm,
   .team-fields, .people-picker). Tokens only; decorative motion under no-preference.
   ================================================================================================== */

/* -- Shared bits ----------------------------------------------------------------------------------- */
/* Long labels + "Optional" on a narrow form: let the hint drop under the label instead of the
   two squeezing into side-by-side columns (.field__label is a flex row). */
:is(.people-auth, .people-settings, .people-modal) .field__label {
  flex-wrap: wrap;
  row-gap: 0;
}
/* When a modal re-renders with errors the first invalid field is focused: keep its label visible. */
.people-modal .modal__body :is(input, textarea, select) {
  scroll-margin-top: 44px;
}
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
}
.file-input:focus-visible + label {
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.segmented__count {
  margin-left: 2px;
  color: var(--text-3-on-fill);
  font-variant-numeric: tabular-nums;
}

/* -- Auth pages ------------------------------------------------------------------------------------ */
.people-auth .auth-card__subtitle {
  text-wrap: balance;
}
.people-auth--wide .auth-card {
  max-width: 560px;
}
/* Full-width buttons on auth cards may carry long Kyrgyz/Russian labels ("Өзгөртүүнү жокко
   чыгарып, бардык жерден чыгуу"): wrap onto a second line instead of overflowing the button. */
.people-auth .auth-card .btn--block {
  height: auto;
  min-height: var(--btn-h);
  padding-block: 8px;
  line-height: 1.25;
  white-space: normal;
  text-wrap: balance;
}
.people-auth .inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 6px;
}
.people-auth .inline-form .link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
.auth-invite {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: calc(var(--space-2) * -1) 0 var(--space-5);
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--fill-1);
}
.auth-invite__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.auth-invite__text strong {
  font-weight: var(--fw-semibold);
}
.auth-invite__text span {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.auth-note {
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-align: center;
  text-wrap: balance;
}

/* Status cards (reset sent / done / expired) */
.auth-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}
.auth-status__art {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-top: calc(var(--space-2) * -1);
  border-radius: 22px;
  background: var(--tone-soft);
  color: var(--tone-ink);
}
.auth-status__text {
  color: var(--text);
  font-size: var(--fs-lg);
  line-height: var(--lh-normal);
  text-wrap: pretty;
}
.auth-status__text strong {
  font-weight: var(--fw-semibold);
  overflow-wrap: anywhere;
}
.auth-status__hint {
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-wrap: balance;
}
.auth-status__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  margin-top: var(--space-3);
}
@media (prefers-reduced-motion: no-preference) {
  .auth-status__art--pop {
    animation: people-pop 520ms var(--ease-spring) 180ms both;
  }
}
@keyframes people-pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
}

/* Password strength meter */
.pw-meter {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}
.pw-meter__bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.pw-meter__bars span {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--fill-2);
  transition: background-color var(--dur-2) ease;
}
.pw-meter__label {
  color: var(--text-2);
  font-size: var(--fs-xs);
}
.pw-meter[data-score="0"] .pw-meter__bars span:nth-child(-n + 1),
.pw-meter[data-score="1"] .pw-meter__bars span:nth-child(-n + 1) {
  background: var(--danger);
}
.pw-meter[data-score="2"] .pw-meter__bars span:nth-child(-n + 2) {
  background: var(--warning);
}
.pw-meter[data-score="3"] .pw-meter__bars span:nth-child(-n + 3),
.pw-meter[data-score="4"] .pw-meter__bars span {
  background: var(--success);
}
.pw-meter[data-score="0"] .pw-meter__label,
.pw-meter[data-score="1"] .pw-meter__label {
  color: var(--danger-ink);
}
.pw-meter[data-score="3"] .pw-meter__label,
.pw-meter[data-score="4"] .pw-meter__label {
  color: var(--success-ink);
}

/* Invitation card (accept page) */
.invite-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding: var(--space-5) var(--space-4) var(--space-4);
  border-radius: var(--radius-xl);
  background: var(--fill-1);
  text-align: center;
}
.invite-card__tile {
  --size: 64px;
  box-shadow: var(--shadow-md);
}
.invite-card__name {
  max-width: 100%;
  margin-top: var(--space-1);
  overflow-wrap: anywhere;
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-snug);
}
.invite-card__people {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  --avatar-ring: var(--surface);
}
.invite-card__facts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--space-2);
  width: 100%;
  max-width: 320px;
  margin: var(--space-2) 0 0;
}
.invite-card__facts > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--card-ring);
}
.invite-card__facts dt {
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.invite-card__facts dd {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invite-card__facts dd {
  margin: 0;
  font-weight: var(--fw-semibold);
}
.invite-card__help {
  max-width: 34ch;
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-wrap: balance;
}

/* -- Workspace identity (name + color + logo with live tile) ------------------------------------------ */
.ws-identity {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.ws-identity__preview {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}
.ws-identity__tile {
  --size: 52px;
  position: relative;
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-3) var(--ease-out);
}
.ws-identity__tile img {
  position: absolute;
  inset: 0;
}
.ws-identity__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ws-identity__name {
  overflow: hidden;
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-snug);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-identity__name:empty::before {
  content: "\2014";
  color: var(--text-3);
}
.ws-identity__sub {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.ws-identity__logo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.ws-identity .swatches {
  gap: 4px;
}

/* -- Onboarding ------------------------------------------------------------------------------------- */
.ob-invites {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.ob-invites__title {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.ob-invite {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--card-ring), var(--shadow-xs);
  color: inherit;
  transition: box-shadow var(--dur-2) ease, transform var(--dur-2) var(--ease-out);
}
.ob-invite:hover {
  box-shadow: 0 0 0 1px var(--card-ring), var(--shadow-md);
}
.ob-invite__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.ob-invite__text strong {
  font-weight: var(--fw-semibold);
}
.ob-invite__text span {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.ob-invites .divider {
  margin-top: var(--space-3);
}

.onboarding {
  --dir: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.onboarding.is-back {
  --dir: -1;
}
.ob-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}
.ob-progress__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.ob-progress__item::before {
  content: "";
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--fill-2);
  transition: background-color var(--dur-3) var(--ease-out);
}
.ob-progress__item.is-current,
.ob-progress__item.is-done {
  color: var(--text);
}
.ob-progress__item.is-current::before,
.ob-progress__item.is-done::before {
  background: var(--accent);
}
.ob-progress__dot {
  display: none;
}
.ob-progress__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 479px) {
  .ob-progress__label {
    line-height: 1.25;
    white-space: normal;
  }
}
/* Without JS every step is visible; the progress bar is meaningless there. */
html:not(.js) .ob-progress {
  display: none;
}

.ob-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.ob-step__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ob-step__title {
  font-size: var(--fs-title-3);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
}
.ob-step__text {
  color: var(--text-2);
  text-wrap: pretty;
}
.ob-nav {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.ob-nav .btn--lg.btn--secondary {
  flex: none;
  width: var(--control-h-lg);
  padding: 0;
}
.ob-nav .grow {
  flex: 1;
}
/* Narrow cards (phones; long Kyrgyz labels): the main action gets its own full-width row,
   Back + Skip sit under it. */
@media (max-width: 479px) {
  .ob-nav {
    flex-wrap: wrap;
  }
  .ob-nav .btn--primary.grow {
    flex: 1 0 100%;
    order: -1;
  }
  .ob-nav .btn--plain.btn--lg {
    flex: 1;
  }
}
.ob-nav .btn__label,
.ob-nav .btn--primary {
  min-width: 0;
}
html:not(.js) .ob-nav,
html:not(.js) .ob-add {
  display: none;
}
.ob-nojs-submit {
  display: none;
}
html:not(.js) .ob-nojs-submit {
  display: block;
}
html:not(.js) .ob-step + .ob-step {
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}
/* Before Alpine starts, show only the initial step (no flash of the whole flow). */
.js .onboarding:not(.is-ready)[data-initial-step="1"] .ob-step:not([data-step="1"]),
.js .onboarding:not(.is-ready)[data-initial-step="2"] .ob-step:not([data-step="2"]),
.js .onboarding:not(.is-ready)[data-initial-step="3"] .ob-step:not([data-step="3"]) {
  display: none;
}
.ob-emails {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ob-add {
  align-self: flex-start;
  margin-top: 2px;
}
.ob-templates {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}
@media (min-width: 560px) {
  .ob-templates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ob-templates legend {
    grid-column: 1 / -1;
  }
}
.ob-template {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
  cursor: pointer;
  transition: box-shadow var(--dur-2) ease, background-color var(--dur-2) ease;
}
.ob-template:hover {
  background: var(--surface-2);
}
.ob-template input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ob-template:has(input:checked) {
  background: var(--accent-softer);
  box-shadow: 0 0 0 2px var(--accent);
}
.ob-template:has(input:focus-visible) {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px var(--focus-ring);
}
.ob-template__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.ob-template__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ob-template__name {
  font-weight: var(--fw-semibold);
}
.ob-template__desc {
  color: var(--text-2);
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
}
.ob-template__check {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: transparent;
  transition: background-color var(--dur-2) ease, color var(--dur-2) ease;
}
.ob-template:has(input:checked) .ob-template__check {
  background: var(--accent);
  box-shadow: none;
  color: var(--text-on-accent);
}
.ob-template__columns {
  display: flex;
  gap: 4px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent);
  mask-image: linear-gradient(to right, black 85%, transparent);
}
.ob-template__column {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-full);
  background: var(--tone-softer);
  color: var(--text-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.ob-template__column i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tone);
}
@media (prefers-reduced-motion: no-preference) {
  .ob-enter {
    transition:
      opacity var(--dur-3) var(--ease-out),
      transform var(--dur-3) var(--ease-out);
  }
  .ob-enter-start {
    opacity: 0;
    transform: translateX(calc(var(--dir) * 28px));
  }
  .ob-enter-end {
    opacity: 1;
    transform: none;
  }
}

/* -- Settings (account + workspace) ----------------------------------------------------------------- */
.settings-nav__label--group {
  margin-top: var(--space-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.people-settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.settings-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
}
.settings-head__text {
  display: flex;
  flex: 1 1 320px;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.settings-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.settings-head__actions:empty {
  display: none;
}
.settings-head__title {
  font-family: var(--font-display);
  font-size: var(--fs-title-1);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
}
.settings-head__subtitle {
  color: var(--text-2);
  font-size: var(--fs-lg);
  text-wrap: pretty;
}
.settings-head__subtitle:empty {
  display: none;
}
.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.settings-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}
.settings-section__foot {
  padding: 0 4px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
/* Inline "✓ Saved" (people.js → flashSaved) */
.saved-tick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  color: var(--success-ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  opacity: 0;
  transform: translateX(-4px);
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out);
  pointer-events: none;
}
.saved-tick.is-visible {
  opacity: 1;
  transform: none;
}
/* Sticky save bar: the footer of a long form turns into a floating "Unsaved changes · Save"
   bar while there is something to save (people.js → trackDirty). */
.save-bar {
  padding: 8px;
  border-radius: var(--radius-lg);
  transition:
    background-color var(--dur-2) ease,
    box-shadow var(--dur-2) ease;
}
/* Only a form with changes pins its footer: a clean form keeps the button in its place instead
   of floating over the fields. */
form.is-dirty .save-bar {
  position: sticky;
  z-index: var(--z-sticky);
  bottom: 12px;
}
.save-bar__note {
  display: none;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  padding-left: 6px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.save-bar__note .icon {
  color: var(--accent);
}
form.is-dirty .save-bar {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: 0 0 0 1px var(--card-ring), var(--shadow-lg);
}
form.is-dirty .save-bar__note {
  display: inline-flex;
}
@media (prefers-reduced-motion: no-preference) {
  form.is-dirty .save-bar {
    animation: people-bar-in var(--dur-3) var(--ease-spring);
  }
}
@keyframes people-bar-in {
  from {
    transform: translateY(8px);
    opacity: 0.6;
  }
}
@media (max-width: 767px) {
  form.is-dirty .save-bar {
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  }
}
.settings-section .list-item__subtitle,
.notif-subtitle,
.danger-zone__text {
  white-space: normal;
}
/* Phones: a row with a text button (Request archive, Turn on, Delete…) puts the button under
   the text instead of squeezing the text into a narrow column. */
@media (max-width: 479px) {
  .people-settings .list-item:not(.ws-row, .session-row):has(> .list-item__trail .btn:not(.btn--icon)) {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .people-settings .list-item:not(.ws-row, .session-row):has(> .list-item__trail .btn:not(.btn--icon)) > .list-item__body {
    flex-basis: calc(100% - var(--item-inset) + 4px);
  }
  .people-settings .list-item:not(.ws-row, .session-row):has(> .list-item__trail .btn:not(.btn--icon)) > .list-item__trail {
    margin-left: calc(var(--item-inset) - 16px);
  }
}
.settings-props {
  margin: var(--space-1) 0 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}
.settings-props dd {
  min-width: 0;
  overflow-wrap: anywhere;
}
.settings-props code {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

/* Avatar / logo editor */
.image-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-5);
}
.image-editor__preview {
  position: relative;
  font-size: 34px;
}
.image-editor__preview img {
  position: absolute;
  inset: 0;
}
.image-editor__preview img:not([src]),
.image-editor__preview img[src=""] {
  display: none;
}
.image-editor__body {
  display: flex;
  flex: 1 1 240px;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.image-editor__title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
}
.image-editor__hint {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.image-editor__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}
@media (max-width: 479px) {
  .image-editor {
    flex-direction: column;
    text-align: center;
  }
  .image-editor__body {
    flex-basis: auto;
    align-items: center;
  }
  .image-editor__actions {
    justify-content: center;
  }
}
.image-editor__pending {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

/* Appearance picker */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.theme-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}
.theme-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.theme-option__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-align: center;
}
.theme-option:has(input:checked) .theme-option__label {
  color: var(--text);
  font-weight: var(--fw-semibold);
}
.theme-art {
  position: relative;
  display: flex;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--line-strong);
  transition: box-shadow var(--dur-2) ease, transform var(--dur-2) var(--ease-out);
}
.theme-option:hover .theme-art {
  transform: translateY(-1px);
}
.theme-option:has(input:checked) .theme-art {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}
.theme-option:has(input:focus-visible) .theme-art {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent), 0 0 0 7px var(--focus-ring);
}
.theme-art--light,
.theme-art__half--light {
  color-scheme: light;
}
.theme-art--dark,
.theme-art__half--dark {
  color-scheme: dark;
}
.theme-art__half {
  display: flex;
  flex: 1 0 100%;
  overflow: hidden;
}
.theme-art--system .theme-art__half--dark {
  position: absolute;
  inset: 0;
  clip-path: polygon(62% 0, 100% 0, 100% 100%, 38% 100%);
}
.theme-art__window {
  display: flex;
  flex: 1;
  background: var(--bg);
}
.theme-art__sidebar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 28%;
  padding: 10% 6%;
  background: var(--bg-sidebar);
  box-shadow: 1px 0 0 var(--line);
}
.theme-art__sidebar i {
  height: 4px;
  border-radius: 2px;
  background: var(--fill-3);
}
.theme-art__sidebar i:first-child {
  background: var(--accent);
  opacity: 0.85;
}
.theme-art__main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6%;
  padding: 9% 8%;
}
.theme-art__title {
  width: 55%;
  height: 6px;
  border-radius: 3px;
  background: var(--text);
  opacity: 0.85;
}
.theme-art__card {
  flex: 1;
  border-radius: 5px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--card-ring), var(--shadow-xs);
}
.theme-art__card--accent {
  flex: 0.6;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%);
}
@media (max-width: 420px) {
  .theme-picker {
    gap: var(--space-2);
  }
  .theme-option__label .icon {
    display: none;
  }
}

/* Language list */
.lang-option {
  gap: 14px;
}
.lang-option__code {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--fill-1);
  color: var(--text-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
}
.lang-option[aria-pressed="true"] .lang-option__code {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.lang-option__check {
  color: var(--accent);
}

/* Time zone */
.tz-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.tz-card__row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.tz-card__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tz-card__label {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.tz-card__now {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-snug);
}
.tz-picker__button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.tz-picker__city {
  overflow: hidden;
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tz-picker__region {
  flex: 1;
  overflow: hidden;
  color: var(--text-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tz-picker__chevron {
  flex-shrink: 0;
  color: var(--text-3);
}
.tz-picker__panel {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 24px));
  max-height: min(440px, 70vh);
  padding: 8px;
}
.tz-picker__panel:not(:popover-open):not(.is-open) {
  display: none;
}
.tz-picker__search {
  margin-bottom: 6px;
}
.tz-picker__list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tz-option {
  flex-shrink: 0;
  gap: 10px;
  min-height: 36px;
}
.tz-option .menu__text {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.tz-option__city {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tz-option__region {
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tz-option__offset {
  flex-shrink: 0;
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.tz-picker__empty {
  padding: 16px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-align: center;
}
.tz-suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--accent-softer);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.tz-suggest > span {
  flex: 1 1 180px;
}
.tz-suggest strong {
  color: var(--text);
}

/* Danger zone */
.danger-zone .settings-section__title {
  color: var(--danger-ink);
}
/* Settings row glyphs: neutral via core (.settings-layout .list-item__icon, content.css). The
   danger zone's card carries a faint red hairline. */
.people-settings .danger-zone .list-group__items {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--danger) 24%, var(--line)),
    var(--shadow-xs);
}

/* Members */
.members-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.members-toolbar__search {
  flex: 1 1 220px;
  min-width: 0;
}
.members-toolbar .segmented {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
@media (max-width: 639px) {
  .members-toolbar .segmented {
    width: 100%;
  }
  .members-toolbar .segmented__item {
    flex: 1 0 auto;
  }
}
.member-list {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--card-ring), var(--shadow-xs);
  container-type: inline-size;
}
.member-list__head {
  display: none;
}
.member-list__empty {
  padding: var(--space-6) var(--space-4);
  color: var(--text-2);
  text-align: center;
}
/* Narrow (phones, small panes): person + menu, then role + teams. The list is a size container,
   so the columns follow its own width (the settings pane is narrower than the window). */
.member-row {
  display: grid;
  grid-template-areas:
    "person person actions"
    "teams role role";
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 12px 12px 16px;
  border-top: 1px solid var(--line);
  transition:
    background-color var(--dur-1) ease,
    opacity var(--dur-2) ease;
}
.member-row:first-of-type,
.member-list__head + .member-row {
  border-top: 0;
}
.member-row[hidden] {
  display: none;
}
.member-row.htmx-swapping {
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .member-row.is-flash {
    animation: people-flash 1100ms var(--ease-out);
  }
}
@keyframes people-flash {
  from {
    background-color: var(--accent-softer);
  }
}
.member-row__person {
  display: flex;
  grid-area: person;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
}
.member-row__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.member-row__name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: var(--fw-medium);
}
.member-row__name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-row__name .badge {
  flex: none;
}
.member-row__person:hover .member-row__name-text {
  color: var(--accent-ink);
}
.member-row__email {
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-row__teams {
  display: flex;
  grid-area: teams;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  padding-left: 44px;
}
.member-row__teams .chip {
  flex-shrink: 1;
  min-width: 0;
  max-width: 140px;
}
.member-row__teams .chip--neutral {
  flex-shrink: 0;
}
.member-row__none {
  color: var(--text-3);
  visibility: hidden; /* a lone dash means nothing in the card layout; the wide table shows it */
}
.member-row__role {
  display: flex;
  grid-area: role;
  justify-content: flex-end;
  gap: 6px;
}
.member-row__role .input {
  width: auto;
  min-width: 128px;
}
.member-row__joined {
  display: none;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.member-row__actions {
  grid-area: actions;
}
/* Medium: a table without the Teams column (teams go under the e-mail). */
@container (min-width: 560px) {
  .member-list__head,
  .member-row {
    grid-template-areas:
      "person role joined actions"
      "teams role joined actions";
    grid-template-columns: minmax(0, 1fr) 156px 92px 32px;
    gap: 2px 14px;
  }
  .member-list__head {
    display: grid;
    grid-template-areas: "person role joined actions";
    align-items: center;
    height: 36px;
    padding: 0 12px 0 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
  }
  .member-list__head > * {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .member-list__head > :nth-child(1) {
    grid-area: person;
  }
  .member-list__head > :nth-child(2) {
    display: none;
  }
  .member-list__head > :nth-child(3) {
    grid-area: role;
  }
  .member-list__head > :nth-child(4) {
    grid-area: joined;
  }
  .member-row {
    padding: 10px 12px 10px 16px;
  }
  .member-row:hover {
    background: var(--fill-1);
  }
  .member-row__teams {
    margin-top: 2px;
  }
  .member-row__teams:has(.member-row__none) {
    display: none;
  }
  .member-row__role {
    justify-content: flex-start;
  }
  .member-row__role .input {
    width: 100%;
    min-width: 0;
  }
  .member-row__joined {
    display: block;
    grid-area: joined;
  }
}
/* Wide: Name · Teams · Role · Joined. */
@container (min-width: 820px) {
  .member-list__head,
  .member-row {
    grid-template-areas: "person teams role joined actions";
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 156px 92px 32px;
    gap: 14px;
  }
  .member-list__head > :nth-child(2) {
    display: block;
    grid-area: teams;
  }
  .member-row__teams {
    flex-wrap: nowrap;
    margin-top: 0;
    overflow: hidden;
    padding-left: 0;
  }
  .member-row__teams:has(.member-row__none) {
    display: flex;
  }
  .member-row__none {
    visibility: visible;
  }
}
.invite-row__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--fill-1);
  color: var(--text-2);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.invite-row .list-item__subtitle {
  white-space: normal;
}
.invite-row.is-expired .list-item__title {
  color: var(--text-2);
}
.invite-row__expired {
  color: var(--warning-ink);
  font-weight: var(--fw-medium);
}
.invite-row .list-item__trail {
  gap: 2px;
}

/* Invite modal */
.invite-form textarea {
  min-height: 84px;
}
.invite-form__count {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  min-height: 1.3em;
}
.invite-form__ok,
.invite-form__invalid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.invite-form__ok {
  color: var(--success-ink);
}
.invite-form__invalid {
  color: var(--warning-ink);
}
.invite-form__area.is-enhanced {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* E-mail chips (token field) */
.email-tokens {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 84px;
  max-height: 220px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  cursor: text;
  transition:
    border-color var(--dur-1) ease,
    box-shadow var(--dur-2) ease;
  align-content: flex-start;
}
.email-tokens:hover {
  border-color: var(--input-border-hover);
}
.email-tokens:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--focus-ring);
}
.field--invalid .email-tokens {
  border-color: var(--danger);
}
.email-tokens__input {
  flex: 1 1 160px;
  min-width: 120px;
  height: 30px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-md);
  outline: none;
}
.email-tokens__input::placeholder {
  color: var(--text-3);
}
.email-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 30px;
  padding: 0 4px 0 3px;
  border-radius: var(--radius-full);
  background: var(--fill-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.email-token__avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
}
.email-token__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-token__remove {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition:
    background-color var(--dur-1) ease,
    color var(--dur-1) ease;
}
.email-token__remove:hover {
  background: var(--fill-3);
  color: var(--text);
}
.email-token__remove:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.email-token.is-invalid {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 35%, transparent);
}
.email-token.is-invalid .email-token__avatar {
  background: var(--danger);
  color: var(--text-on-accent);
}
.email-token.is-invalid .email-token__remove {
  color: var(--danger-ink);
}
@media (prefers-reduced-motion: no-preference) {
  .email-token {
    animation: people-token-in var(--dur-2) var(--ease-spring) both;
  }
}
@keyframes people-token-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
}
@media (pointer: coarse) {
  .email-token {
    height: 34px;
  }
  .email-token__remove {
    width: 28px;
    height: 28px;
  }
  .email-tokens__input {
    height: 34px;
    font-size: 16px;
  }
}
/* "No" shake — form errors, wrong codes (people.js → shake()) */
@media (prefers-reduced-motion: no-preference) {
  .is-shaking {
    animation: people-shake 420ms var(--ease-out);
  }
}
@keyframes people-shake {
  10%,
  90% {
    transform: translateX(-1px);
  }
  20%,
  80% {
    transform: translateX(3px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-6px);
  }
  40%,
  60% {
    transform: translateX(6px);
  }
}
.role-picker {
  margin: 0;
  padding: 0;
  border: 0;
}
.role-picker__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 8px;
}
.role-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 1px var(--line-strong);
  cursor: pointer;
  transition: box-shadow var(--dur-1) ease, background-color var(--dur-1) ease;
}
.role-option:hover {
  background: var(--fill-1);
}
.role-option input {
  margin-top: 2px;
}
.role-option:has(input:checked) {
  background: var(--accent-softer);
  box-shadow: 0 0 0 1.5px var(--accent);
}
.role-option__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.role-option__name {
  font-weight: var(--fw-semibold);
}
.role-option__help {
  color: var(--text-2);
  font-size: var(--fs-sm);
}

/* Delete workspace */
/* r4 · 12.25: dangerous sheets lead with a 56 px app-icon squircle (red; transfer — orange). */
.delete-confirm__art {
  display: grid;
  place-items: center;
  align-self: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--tone-gradient);
  color: var(--tone-on);
  box-shadow:
    inset 0 0.5px 0 rgb(255 255 255 / 0.35),
    inset 0 0 0 0.5px rgb(0 0 0 / 0.06),
    var(--shadow-md);
}
.delete-confirm__art .icon {
  --icon-stroke: 2.2;
  width: 28px;
  height: 28px;
}
.delete-confirm__text {
  color: var(--text-2);
  text-align: center;
  text-wrap: pretty;
}
.delete-confirm__text strong,
.delete-confirm .field__label strong {
  color: var(--text);
  font-weight: var(--fw-semibold);
  overflow-wrap: anywhere;
}

/* Labels */
.label-create__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.label-create__row > .input {
  flex: 1;
  min-width: 0;
}
.label-create__swatch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: var(--control-h);
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--fill-1);
  color: var(--text-2);
  cursor: pointer;
}
.label-create__swatch:hover {
  background: var(--fill-2);
}
.label-create__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(150deg, color-mix(in oklab, var(--tone) 80%, white), var(--tone));
  box-shadow: inset 0 0 0 0.5px var(--line-strong);
}
.label-color-panel {
  width: min(248px, calc(100vw - 24px));
  padding: 10px;
}
@media (max-width: 479px) {
  .label-create .btn__label {
    display: none;
  }
  .label-create .btn--primary {
    width: var(--control-h);
    padding: 0;
  }
}
.label-row {
  position: relative;
  transition: opacity var(--dur-2) ease;
}
.label-row.htmx-swapping {
  opacity: 0;
}
li + .label-row > .list-item::before,
li + .label-row > .label-row__form::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 16px;
  height: 1px;
  background: var(--line);
}
.label-row__view {
  gap: 10px;
}
.label-row__view .chip {
  max-width: min(60%, 320px);
}
.label-row__count {
  flex-shrink: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.label-row__actions {
  gap: 0;
}
.label-row__delete:hover {
  color: var(--danger-ink);
}
.label-row__form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
}
.label-row__form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.label-row.is-new .label-row__view {
  animation: people-flash 1.6s var(--ease-out);
}
@keyframes people-flash {
  from {
    background: var(--accent-soft);
  }
}

/* -- People directory ----------------------------------------------------------------------------- */
.people-page,
.person-page,
.teams-page,
.team-page {
  max-width: var(--content-max);
  margin-inline: auto;
}
.people-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.people-toolbar__search {
  max-width: 420px;
}
.people-toolbar__teams {
  display: flex;
  gap: 6px;
  margin-inline: calc(var(--page-pad-x) * -1);
  padding: 2px var(--page-pad-x);
  overflow-x: auto;
  scrollbar-width: none;
}
.people-toolbar__teams::-webkit-scrollbar {
  display: none;
}
/* Team filter pills: core .filter-pill (static/css/core/toolbar.css). */
@keyframes people-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@media (min-width: 640px) {
  .people-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .people-toolbar__search {
    flex: 0 1 280px;
  }
  .people-toolbar__teams {
    flex: 1 1 0;
    min-width: 0;
    margin-inline: 0;
    padding-inline: 0;
  }
}

/* -- Person page --------------------------------------------------------------------------------- */
.person-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  text-align: center;
}
.person-hero > .avatar {
  box-shadow: 0 0 0 4px var(--surface), var(--shadow-md);
}

.person-hero__name {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: var(--fs-title-1);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
}
.person-hero__title {
  color: var(--text-2);
  font-size: var(--fs-lg);
}

.person-hero__teams {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.person-team {
  gap: 6px;
  padding-left: 4px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text);
  transition: background-color var(--dur-1) ease;
}
.person-team:hover {
  background: var(--fill-1);
}
/* Work progress on the person / team pages is neutral (a finished project turns green); the
   project's own color stays in its tile. */
.mini-list__bar.progress .progress__bar,
.team-project__progress .progress .progress__bar {
  background: var(--text-3);
}
.person-team__lead {
  color: var(--c-orange-ink);
}
/* Phones/tablets: Tasks · Projects · Activity as tabs (one column would be very long). */
.person-tabs {
  display: none;
}
@media (max-width: 1023px) {
  html.js .person-tabs {
    position: sticky;
    z-index: 5;
    top: calc(var(--topbar-h) + var(--safe-top) + 8px);
    display: flex;
    margin-bottom: var(--space-4);
    box-shadow: 0 0 0 4px var(--bg);
  }
  html.js .person-page[data-tab="tasks"] .person-aside,
  html.js .person-page:not([data-tab="tasks"]) .person-main,
  html.js .person-page[data-tab="projects"] .person-activity,
  html.js .person-page[data-tab="activity"] .person-projects {
    display: none;
  }
}
.person-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
@media (max-width: 479px) {
  .person-stats {
    gap: var(--space-2);
  }
  .person-stats .card {
    --card-pad: 12px;
  }
  .person-stats .stat__label {
    font-size: var(--fs-2xs);
  }
  .person-stats .stat__label .icon-tile {
    display: none;
  }
}
.person-layout,
.team-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
}
.person-layout > *,
.team-layout > * {
  min-width: 0;
}
.person-group + .person-group {
  margin-top: var(--space-3);
}
.person-group .task-row__meta > .avatar:last-child {
  display: none;
}
.person-group__head {
  justify-content: space-between;
}
.person-group__count {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.person-muted,
.person-more {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.person-more {
  margin-top: var(--space-2);
  padding: 0 4px;
}
.person-aside__title {
  margin-bottom: var(--space-3);
}
@media (min-width: 1024px) {
  .person-layout,
  .team-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }
}
.mini-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 -8px;
  padding: 0;
  list-style: none;
}
.mini-list__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  color: inherit;
}
.mini-list__item:hover {
  background: var(--fill-1);
}
.mini-list__text {
  overflow: hidden;
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-list__value {
  color: var(--text-2);
  font-size: var(--fs-xs);
}
.mini-list__bar {
  grid-column: 2 / -1;
}

/* Activity feed */
.feed {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.feed__item {
  position: relative;
  display: flex;
  gap: 10px;
  padding-bottom: 14px;
}
.feed__item:last-child {
  padding-bottom: 0;
}
.feed__item:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 26px;
  bottom: 2px;
  left: 11px;
  width: 1.5px;
  border-radius: 1px;
  background: var(--line);
}
.feed__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--fill-1);
  color: var(--text-2);
}
.feed__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: 2px;
}
.feed__text {
  overflow-wrap: anywhere;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}
.feed__text strong {
  font-weight: var(--fw-semibold);
}
.feed__text a {
  color: var(--accent-ink);
}
.feed__details {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-xs);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.feed__time {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.feed__empty {
  color: var(--text-2);
  font-size: var(--fs-sm);
}

/* -- Teams --------------------------------------------------------------------------------------- */
.teams-filter {
  flex-shrink: 0;
}
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 296px), 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.team-grid > li {
  min-width: 0;
}
/* r3: one calm surface like the project cards — the tile is the team's identity, nothing else
   is tinted. */
.team-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 16px 16px 12px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--card-ring),
    var(--shadow-xs);
  transition: box-shadow var(--dur-2) var(--ease-out);
}
@media (hover: hover) {
  .team-card:hover {
    box-shadow:
      0 0 0 1px var(--line-strong),
      var(--shadow-sm);
  }
}
.team-card:has(.team-card__link:focus-visible) {
  box-shadow:
    0 0 0 2px var(--focus-outline),
    0 0 0 5px var(--focus-ring);
}
.team-card__link:focus-visible {
  outline: none;
}
.team-card__link {
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
}
.team-card__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.team-card__titles {
  flex: 1;
  min-width: 0;
}
.team-card__name {
  overflow: hidden;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-card__meta {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
/* Membership is a state, not an alert: neutral badge (the lead badge keeps the accent). */
.team-card__head .badge--success {
  background: var(--fill-1);
  color: var(--text-2);
}
.team-card__head .badge {
  gap: 3px;
  flex: none;
}
/* Optimistic Join / Leave (people.js): the badge reacts before the server answers. */
.team-card__badge--ghost {
  display: none;
}
.team-card.is-joining .team-card__badge--ghost {
  display: inline-flex;
}
.team-card__badge {
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out);
}
.team-card.is-leaving .team-card__badge {
  opacity: 0;
  transform: scale(0.8);
}
@media (prefers-reduced-motion: no-preference) {
  .team-card.is-joining .team-card__badge--ghost {
    animation: people-pop 420ms var(--ease-spring) both;
  }
  .team-card[data-changed] .team-card__foot .avatar-stack {
    animation: people-fade-in var(--dur-3) var(--ease-out) both;
  }
}
@keyframes people-fade-in {
  from {
    opacity: 0;
  }
}
.team-card__desc {
  display: -webkit-box;
  flex: 1;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.team-card__placeholder {
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.team-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 32px;
  padding-top: 12px;
  border-top: 1px solid var(--line-subtle);
}
.team-card__action {
  position: relative;
  z-index: 2;
}

.team-hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--card-ring), var(--shadow-xs);
}
.team-hero__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.team-hero__name {
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: var(--fs-title-2);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
}
.team-hero__desc {
  max-width: 65ch;
  color: var(--text-2);
  text-wrap: pretty;
}
.team-hero__people {
  display: none;
}
@media (min-width: 768px) {
  .team-hero__people {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    margin-left: auto;
    color: var(--text-2);
    font-size: var(--fs-sm);
    text-align: right;
    --avatar-ring: var(--surface);
  }
}
.team-hero__add-desc {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.team-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 2px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
@media (max-width: 479px) {
  .team-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-4);
  }
}
.team-projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.team-project {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}
.team-project__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.team-project__name {
  display: -webkit-box;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.team-project__head .status-pill {
  flex-shrink: 0;
  align-self: flex-start;
}
.team-project__progress {
  width: 100%;
}
.team-project__progress .progress {
  flex: 1;
}
.team-project__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: var(--fs-xs);
}
.team-project__foot > :last-child:is(.avatar) {
  margin-left: auto;
}
.team-project__foot {
  flex-wrap: wrap;
}
.team-members .card__title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.team-member-list {
  margin: 0;
  padding: 6px;
  list-style: none;
}
.team-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 8px;
  border-radius: var(--radius-md);
  transition: background-color var(--dur-1) ease, opacity var(--dur-2) ease;
}
.team-member:hover {
  background: var(--fill-1);
}
.team-member.htmx-swapping {
  opacity: 0;
}
.team-member__person {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
}
.team-member__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.team-member__line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.team-member__name {
  overflow: hidden;
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-member__you {
  flex: none;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.team-member__lead {
  display: grid;
  flex: none;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c-orange) 16%, transparent);
  color: var(--c-orange-ink);
}
.team-member__title {
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-members__empty {
  padding: var(--space-5);
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-align: center;
}
@media (min-width: 1024px) {
  .team-layout {
    grid-template-areas:
      "projects aside"
      "activity aside";
    grid-template-rows: auto 1fr;
  }
  .team-layout__projects {
    grid-area: projects;
  }
  .team-layout__activity {
    grid-area: activity;
  }
  .team-aside {
    position: sticky;
    top: calc(var(--topbar-h) + var(--safe-top) + 16px);
    grid-area: aside;
    align-self: start;
  }
}

/* Team forms */
.team-form-page {
  max-width: 640px;
  margin-inline: auto;
}
.team-fields {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}
.team-fields__preview {
  flex-shrink: 0;
  padding-top: 26px;
}
.team-fields__preview .icon-tile {
  transition: background var(--dur-3) var(--ease-out);
}
.team-fields__main {
  flex: 1;
  min-width: 0;
}
@media (max-width: 479px) {
  .team-fields__preview {
    display: none;
  }
}
.team-delete-btn {
  margin-right: auto;
}
@media (max-width: 479px) {
  .team-delete-btn .btn__label {
    display: none;
  }
}
.people-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.people-picker__legend {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0;
}
.people-picker__count {
  color: var(--accent-ink);
  font-weight: var(--fw-semibold);
}
.people-picker__list {
  max-height: 232px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  list-style: none;
}
.people-picker__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.people-picker__item:hover {
  background: var(--fill-1);
}
.people-picker__item:has(input:checked) {
  background: var(--accent-softer);
}
.people-picker__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.people-picker__name {
  overflow: hidden;
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.people-picker__meta {
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.people-picker__empty {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--fill-1);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

/* ==================================================================================================
   Account security (accounts app, B1): Google button, consent, split code inputs, envelope
   animation, app-shell banners, Security / Account settings, workspace security, recovery codes.
   ================================================================================================== */

/* -- Google button (Google sign-in branding: neutral fill, 1px outline, the four-colour G) ------- */
.gsi-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.gsi-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: var(--control-h-lg);
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-lg);
  font-weight: var(--fw-medium);
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition:
    background-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}
.gsi-button:hover {
  background: color-mix(in srgb, var(--surface) 92%, var(--text));
  box-shadow: var(--shadow-sm);
}
.gsi-button:active {
  transform: scale(0.985);
}
.gsi-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.gsi-button__logo {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
}
.gsi-button--sm {
  width: auto;
  min-height: var(--control-h-sm);
  gap: 8px;
  padding: 0 12px;
  font-size: var(--fs-sm);
}
.gsi-button--sm .gsi-button__logo {
  width: 16px;
  height: 16px;
}
.gsi-button--sm svg {
  width: 16px;
  height: 16px;
}
.gsi-note {
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: var(--lh-normal);
  text-align: center;
  text-wrap: balance;
}
.gsi-note .link {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.list-item__icon.gsi-tile {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.auth-or {
  margin: var(--space-5) 0;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

/* -- Sign-up: consent, honeypot, Turnstile ------------------------------------------------------ */
.hp-field {
  position: absolute !important;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  cursor: pointer;
}
.consent input {
  flex: none;
  margin-top: 1px;
}
.consent .link {
  font-weight: var(--fw-medium);
}
.turnstile {
  display: flex;
  justify-content: center;
  min-height: 65px;
}

/* -- Two-factor sign-in ------------------------------------------------------------------------- */
.auth-who {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: calc(var(--space-2) * -1) auto var(--space-5);
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-full);
  background: var(--fill-1);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.otp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 10px);
}
.otp__cell {
  width: clamp(34px, 10vw, 52px);
  height: clamp(46px, 13vw, 60px);
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(22px, 6vw, 28px);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  text-align: center;
  caret-color: var(--accent);
  box-shadow: var(--shadow-xs);
  transition:
    border-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    background-color var(--dur-3) var(--ease-out),
    color var(--dur-3) var(--ease-out),
    transform var(--dur-2) var(--ease-spring);
}
.otp__cell:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.otp__sep {
  flex: none;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--line-strong);
}
.otp.is-error .otp__cell,
.field.is-error .input {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
}
.otp.is-success .otp__cell {
  border-color: var(--success);
  background: var(--success);
  color: var(--text-on-accent);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.otp-error {
  color: var(--danger-ink);
  font-size: var(--fs-sm);
  text-align: center;
}
.otp-fallback {
  text-align: center;
  letter-spacing: 0.3em;
}
.tfa-recovery-input {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}
.tfa-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
  .otp.is-error,
  .field.is-error {
    animation: otp-shake 420ms var(--ease-out);
  }
  .otp.is-success .otp__cell {
    animation: otp-pop 420ms var(--ease-spring) both;
    animation-delay: calc(var(--i, 0) * 70ms);
  }
}
@keyframes otp-shake {
  15%,
  55% {
    transform: translateX(-8px);
  }
  35%,
  75% {
    transform: translateX(7px);
  }
  90% {
    transform: translateX(-2px);
  }
}
@keyframes otp-pop {
  45% {
    transform: scale(1.12);
  }
}

/* -- Envelope → ✓ (verification pages) ----------------------------------------------------------- */
.envelope {
  display: grid;
  place-items: center;
  margin: calc(var(--space-3) * -1) 0 var(--space-1);
  --env: var(--accent);
}
.envelope svg {
  overflow: visible;
}
.envelope--error {
  --env: var(--c-orange);
}
.envelope__back {
  fill: color-mix(in srgb, var(--env) 30%, var(--surface));
}
.envelope__flap-open {
  fill: color-mix(in srgb, var(--env) 42%, var(--surface));
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scaleY(0);
}
.envelope__paper {
  fill: var(--surface);
  stroke: var(--line);
}
.envelope__line {
  fill: var(--fill-3);
}
.envelope__check-bg {
  fill: var(--success);
}
.envelope__check {
  fill: none;
  stroke: var(--text-on-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.envelope__front {
  fill: color-mix(in srgb, var(--env) 62%, var(--surface));
}
.envelope__flap {
  fill: color-mix(in srgb, var(--env) 78%, var(--surface));
  transform-box: fill-box;
  transform-origin: 50% 0;
}
.envelope__alert circle {
  fill: var(--c-orange);
}
.envelope__alert path {
  stroke: var(--text-on-accent);
  stroke-width: 3.2;
  stroke-linecap: round;
}
.envelope__letter {
  transform: translateY(14px);
}
.envelope__badge {
  opacity: 0;
}
.envelope--error .envelope__letter {
  display: none;
}
/* Final states (also the reduced-motion look) */
.envelope--done .envelope__flap {
  transform: scaleY(0);
}
.envelope--done .envelope__flap-open {
  transform: scaleY(1);
}
.envelope--done .envelope__letter {
  transform: translateY(-14px);
}
.envelope--done .envelope__badge {
  opacity: 1;
}
@media (prefers-reduced-motion: no-preference) {
  .envelope {
    animation: people-pop 520ms var(--ease-spring) 120ms both;
  }
  .envelope--sent .envelope__letter {
    animation: env-peek 2.4s var(--ease-in-out) 700ms infinite alternate;
  }
  .envelope--done .envelope__flap {
    animation: env-flap-close 260ms var(--ease-in-out) 520ms both;
  }
  .envelope--done .envelope__flap-open {
    animation: env-flap-open 260ms var(--ease-out) 780ms both;
  }
  .envelope--done .envelope__letter {
    animation: env-letter 560ms var(--ease-spring) 980ms both;
  }
  .envelope--done .envelope__badge {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: env-badge 420ms var(--ease-spring) 1380ms both;
  }
  .envelope--done .envelope__check {
    stroke-dasharray: 24;
    animation: env-check 380ms var(--ease-out) 1560ms both;
  }
  .envelope--error .envelope__alert {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: env-badge 420ms var(--ease-spring) 520ms both;
  }
}
@keyframes env-peek {
  to {
    transform: translateY(4px);
  }
}
@keyframes env-flap-close {
  from {
    transform: scaleY(1);
  }
  to {
    transform: scaleY(0);
  }
}
@keyframes env-flap-open {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}
@keyframes env-letter {
  from {
    transform: translateY(14px);
  }
  to {
    transform: translateY(-14px);
  }
}
@keyframes env-badge {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes env-check {
  from {
    stroke-dashoffset: 24;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* -- "Verify your e-mail first" ----------------------------------------------------------------- */
.verify-first {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}
.verify-first__art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--tone-soft);
  color: var(--tone-ink);
}
.verify-first__text {
  font-size: var(--fs-lg);
  text-wrap: pretty;
}
.verify-first__text strong {
  overflow-wrap: anywhere;
}
.verify-first__hint {
  color: var(--text-2);
  font-size: var(--fs-sm);
}

/* -- App-shell banners -------------------------------------------------------------------------- */
.account-notices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px var(--page-pad-x) 0;
}
.account-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--tone-line);
  border-radius: var(--radius-lg);
  background: var(--tone-softer);
  color: var(--text);
  font-size: var(--fs-sm);
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out);
}
.account-notice[hidden] {
  display: none;
}
.account-notice.is-leaving {
  opacity: 0;
  transform: translateY(-4px);
}
.account-notice__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--tone-soft);
  color: var(--tone-ink);
}
.account-notice__text {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
}
.account-notice__text strong {
  font-weight: var(--fw-semibold);
}
.account-notice__detail {
  min-width: 0;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.account-notice__action {
  display: contents;
}
.account-notice__btn {
  flex: none;
  color: var(--tone-ink);
  font-weight: var(--fw-semibold);
}
.account-notice__close {
  flex: none;
  color: var(--text-3);
}
@media (max-width: 639px) {
  .account-notices {
    padding-top: 6px;
  }
  .account-notice {
    gap: 8px;
    min-height: 40px;
    padding: 4px 2px 4px 8px;
  }
  .account-notice__icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
  }
  .account-notice__text strong {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.25;
  }
  .account-notice__detail {
    display: none;
  }
  .account-notice__btn {
    padding-inline: 8px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .account-notice {
    animation: notice-in var(--dur-3) var(--ease-out) both;
  }
}
@keyframes notice-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* -- Settings → Security ------------------------------------------------------------------------ */
.sec-glance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}
.sec-glance__item {
  --tone: var(--c-orange);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon label" "icon value";
  align-items: center;
  column-gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--card-ring), var(--shadow-xs);
}
.sec-glance__item[data-ok="true"] {
  --tone: var(--c-green);
}
.sec-glance__icon {
  display: grid;
  grid-area: icon;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--tone) 16%, transparent);
  color: var(--tone);
}
.sec-glance__label {
  grid-area: label;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sec-glance__value {
  grid-area: value;
  overflow: hidden;
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 519px) {
  .sec-glance {
    grid-template-columns: 1fr;
  }
  .sec-glance__item {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "icon label value";
    padding: 10px 12px;
  }
  .sec-glance__icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }
  .sec-glance__label {
    color: var(--text);
    font-size: var(--fs-md);
  }
  .sec-glance__value {
    color: var(--text-2);
    font-weight: var(--fw-medium);
  }
}
.sec-title-row {
  justify-content: flex-start;
}
.sec-title-row h3 {
  font: inherit;
}
.tfa-disable {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}
.tfa-disable__toggle {
  color: var(--danger-ink);
}
.tfa-disable__form {
  width: 100%;
}
.session-row__badge {
  margin-left: 6px;
  vertical-align: 1px;
}
.session-row.is-current .list-item__title {
  font-weight: var(--fw-semibold);
}
.sessions-footer {
  display: flex;
  justify-content: flex-end;
}
.signin-log {
  display: flex;
  flex-direction: column;
}
.signin-log__row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 16px;
}
.signin-log__row + .signin-log__row {
  border-top: 1px solid var(--line);
}
.signin-log__status {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--success) 16%, transparent);
  color: var(--success-ink);
}
.signin-log__row.is-failure .signin-log__status {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger-ink);
}
.signin-log__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.signin-log__title {
  font-weight: var(--fw-medium);
}
.signin-log__row.is-failure .signin-log__title {
  color: var(--danger-ink);
}
.signin-log__meta {
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signin-log__time {
  flex: none;
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 479px) {
  .signin-log__row {
    flex-wrap: wrap;
    padding: 10px 14px;
  }
  .signin-log__body {
    flex-basis: calc(100% - 34px);
  }
  .signin-log__time {
    margin-left: 34px;
    font-size: var(--fs-xs);
  }
}

/* Long lists (sessions, sign-ins): the first rows, then "Show all (N)" (Alpine `all`). */
html.js .sessions-list:not(.is-expanded) > .is-extra,
html.js .signin-log:not(.is-expanded) > .is-extra {
  display: none;
}
@media (prefers-reduced-motion: no-preference) {
  .sessions-list.is-expanded > .is-extra,
  .signin-log.is-expanded > .is-extra {
    animation: people-rise var(--dur-3) var(--ease-out) both;
  }
}
.list-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background-color var(--dur-1) ease;
}
.list-more:hover {
  background: var(--fill-1);
}
.list-more:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--focus-ring);
}
.list-more__chevron {
  transition: transform var(--dur-2) var(--ease-out);
}
.list-more[aria-expanded="true"] .list-more__chevron {
  transform: rotate(180deg);
}
html:not(.js) .list-more {
  display: none;
}

/* -- Two-factor setup --------------------------------------------------------------------------- */
.tfa-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  counter-reset: none;
}
.tfa-step {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
}
.tfa-step__num {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: var(--fw-bold);
}
.tfa-step__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.tfa-step__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
}
.tfa-step__text {
  color: var(--text-2);
  text-wrap: pretty;
}
.tfa-qr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5);
  margin-top: var(--space-2);
}
.qr-code {
  display: grid;
  flex: none;
  place-items: center;
  width: 188px;
  height: 188px;
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-xl);
  /* Always dark modules on a light tile — scanners need the contrast, also in dark mode. */
  background: var(--text-on-accent);
  color: light-dark(var(--surface-inverse), var(--text-inverse));
  box-shadow: var(--card-ring), var(--shadow-md);
}
.qr-code__svg {
  display: block;
  width: 100%;
  height: 100%;
}
.qr-code__svg path {
  fill: currentColor;
}
.tfa-manual {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.tfa-manual__label,
.tfa-manual__hint {
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.tfa-key {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}
.tfa-key__value {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}
.tfa-form--inline {
  align-items: flex-start;
}
.tfa-form--inline .otp {
  justify-content: flex-start;
}
.tfa-form--inline .otp-error {
  text-align: left;
}
.tfa-form--inline .form-actions {
  width: 100%;
}
@media (max-width: 519px) {
  .tfa-step {
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
  }
  .tfa-qr-row {
    justify-content: center;
  }
  .tfa-form--inline .otp {
    justify-content: center;
    width: 100%;
  }
}

/* -- Recovery codes ----------------------------------------------------------------------------- */
.recovery-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
}
.recovery-card__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.recovery-card__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
}
.recovery-card__text {
  color: var(--text-2);
}
.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  justify-content: center;
  gap: 2px var(--space-6);
  margin: 0;
  padding: var(--space-4) var(--space-5);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  list-style: none;
  counter-reset: recovery-code;
}
.recovery-codes__item {
  counter-increment: recovery-code;
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 10px;
  padding: 7px 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.recovery-codes__item::before {
  content: counter(recovery-code);
  min-width: 1.4em;
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  letter-spacing: 0;
  text-align: right;
}
.recovery-codes__item code {
  color: var(--text);
  font: inherit;
  user-select: all;
}
.recovery-card__print-meta {
  display: none;
}
.recovery-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
@media (max-width: 419px) {
  .recovery-codes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--space-2);
    padding: var(--space-3) var(--space-2);
  }
  .recovery-codes__item {
    gap: 6px;
    padding: 6px 0;
    font-size: var(--fs-sm);
    letter-spacing: 0.02em;
  }
  .recovery-card__actions .spacer {
    display: none;
  }
  .recovery-card__actions .btn--primary {
    width: 100%;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .recovery-codes__item {
    animation: people-pop 380ms var(--ease-spring) both;
    animation-delay: calc(120ms + var(--i, 0) * 40ms);
  }
}
@media print {
  .is-printing-codes body * {
    visibility: hidden;
  }
  .is-printing-codes .recovery-card,
  .is-printing-codes .recovery-card * {
    visibility: visible;
  }
  .is-printing-codes .recovery-card {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    box-shadow: none;
  }
  .is-printing-codes .recovery-card__actions,
  .is-printing-codes .recovery-card__head .icon-tile {
    display: none;
  }
  .is-printing-codes .recovery-card__print-meta {
    display: block;
  }
}

/* -- Settings → Account ------------------------------------------------------------------------- */
.ws-row .ws-tile {
  --size: 36px;
}
.ws-row__name {
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-row__name:hover {
  color: var(--accent-ink);
}
.ws-row__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ws-row__actions form {
  display: contents;
}
.ws-rows__footer .link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: var(--fw-medium);
}
.account-email__actions {
  display: flex;
  gap: var(--space-2);
}
.email-change-form {
  margin-top: var(--space-2);
}
.delete-steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.delete-steps__item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.delete-steps__dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}
.delete-steps__item.is-done .delete-steps__dot {
  background: var(--success);
}
.delete-steps__item.is-muted {
  opacity: 0.55;
}
.delete-steps__item.is-muted .delete-steps__dot {
  background: var(--fill-3);
  color: var(--text-2);
}
.delete-facts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: var(--space-2);
  color: var(--text-2);
}
.delete-facts li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.delete-facts .icon {
  flex: none;
  margin-top: 2px;
  color: var(--text-3);
}

/* -- Workspace settings → Security -------------------------------------------------------------- */
.ws-security__save {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.ws-security .list-item__trail form {
  display: inline-flex;
}
.ws-security .list-item__trail {
  gap: 6px;
}
.wss-head {
  justify-content: space-between;
}
.wss-coverage {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.wss-coverage .progress {
  width: 96px;
}
.wss-on {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success-ink);
}
/* Two columns when the pane is wide enough (the list is long in big workspaces). */
.ws-security .list-group:has(.wss-members) {
  container-type: inline-size;
}
@container (min-width: 620px) {
  .wss-members {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .wss-members > li:nth-child(even) {
    border-left: 1px solid var(--line);
  }
  .wss-members > li:nth-child(2) > .list-item::before {
    display: none;
  }
}

.account-danger .settings-section__title {
  color: var(--danger-ink);
}
.account-danger__text {
  white-space: normal;
}
.restore-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--c-orange) 14%, transparent);
  color: var(--c-orange-ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

/* ==================================================================================================
   r4 · Э10 «Birge OS» — People, teams, settings, sign-in, Appearance (spec §12.15, §12.18, §12.19,
   §12.25, §13.4). Later in the file = wins over the r3 rules above at equal specificity.
   ================================================================================================== */

/* -- r4 · 12.18: Settings — System Settings ------------------------------------------------------- */
.settings-nav__tile {
  flex-shrink: 0;
}
.settings-nav__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-nav__item .settings-nav__tile .icon {
  color: inherit;
}
.settings-nav__user {
  display: none;
}
.settings-content {
  max-width: 680px;
}
@media (min-width: 1024px) {
  .settings-layout {
    grid-template-columns: 240px minmax(0, 680px);
    justify-content: start;
    gap: var(--space-8);
  }
  .settings-nav {
    gap: 1px;
  }
  .settings-nav__user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: 0 0 0 0.5px var(--card-ring), var(--shadow-xs);
    color: var(--text);
    transition: background-color var(--dur-1) ease, transform var(--dur-snappy) var(--spring-snappy);
  }
  .settings-nav__user:hover {
    background: var(--surface-2);
  }
  .settings-nav__user:active {
    transform: scale(0.98);
  }
  .settings-nav__user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .settings-nav__user-name {
    overflow: hidden;
    font-size: var(--type-body);
    font-weight: var(--fw-semibold);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .settings-nav__user-sub {
    overflow: hidden;
    color: var(--text-3);
    font-size: var(--type-footnote);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .settings-nav__label {
    padding: 10px 10px 4px;
    color: var(--text-3);
    font-size: var(--type-caption2);
    font-weight: var(--fw-semibold);
  }
  .settings-nav__label--group {
    margin-top: var(--space-2);
  }
  .settings-nav__item {
    gap: 8px;
    height: 32px;
    padding: 0 8px;
    color: var(--text);
    font-weight: var(--fw-regular);
  }
  .settings-nav__item:hover {
    background: var(--fill-1);
  }
  .settings-nav__item.is-active {
    background: var(--sidebar-selection);
    color: var(--text);
    font-weight: var(--fw-medium);
  }
}
/* Phones/tablets: the strip of capsules (fill-1, 32 px, 18 px squircle + text); the current one
   is accent-filled with white text. */
@media (max-width: 1023px) {
  .settings-nav__item {
    gap: 7px;
    height: 32px;
    padding: 0 12px 0 7px;
    background: var(--fill-1);
    color: var(--text);
    font-size: var(--type-subhead);
    font-weight: var(--fw-medium);
  }
  .settings-nav__item .settings-nav__tile {
    --size: 18px;
  }
  .settings-nav__item.is-active {
    background: var(--selection-bg);
    color: var(--text-on-accent);
  }
  .settings-nav__item.is-active .settings-nav__tile {
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.55);
  }
}

/* Content: large title, iOS group headers (13 px) and footers (12 px). */
.people-settings {
  gap: var(--space-7, 28px);
}
.settings-head__title {
  font-size: var(--type-large);
}
.settings-head__subtitle {
  font-size: var(--type-subhead);
}
.settings-section {
  gap: 6px;
}
.settings-section__title {
  min-height: 18px;
  padding: 0 16px;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: var(--type-subhead);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
}
.settings-section__foot {
  padding: 0 16px;
  color: var(--text-3);
  font-size: var(--type-footnote);
  text-wrap: pretty;
}
/* Danger zone: a plain group (no red frame); only the destructive row reads red. */
.people-settings .danger-zone .list-group__items {
  box-shadow: 0 0 0 0.5px var(--card-ring), var(--shadow-xs);
}
:is(.danger-zone, .account-danger) .list-item:has(> .list-item__icon[data-color="red"]) .list-item__title {
  color: var(--danger-ink);
}

/* -- r4 · 13.4: Appearance ------------------------------------------------------------------------- */
.theme-option:has(input:checked) .theme-art {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4.5px var(--accent);
}
.appearance-extra { margin-top: 16px; }
.accent-swatches { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; max-width: 100%; }
.appearance-extra .form-row { flex-wrap: wrap; }
.appearance-extra .form-row__control { max-width: 100%; }
.accent-swatch {
  position: relative;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, color-mix(in oklab, var(--sw) 80%, white), var(--sw));
  box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.12);
  transition: transform var(--dur-snappy) var(--spring-snappy), box-shadow var(--dur-2) ease;
}
/* 44 px touch target around the 22 px dot (§14.1). */
.accent-swatch::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
}
.accent-swatch:active { transform: scale(0.88); }
.accent-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.accent-swatch[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.95);
}
.accent-swatch:focus-visible { outline-offset: 4px; }
.text-size-control__a { font-weight: var(--fw-semibold); line-height: 1; }
.text-size-control .segmented__item {
  min-width: 40px;
}
@media (max-width: 479px) {
  .appearance-extra .form-row {
    padding-block: 10px;
    row-gap: 10px;
  }
  .accent-swatches {
    justify-content: flex-start;
    gap: 12px;
  }
}

/* -- r4 · 12.15: People — Contacts ----------------------------------------------------------------- */
.people-book {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.people-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-margin-top: calc(var(--topbar-h) + var(--safe-top) + 8px);
}
/* The letter: a sticky glass caption that stays while its group scrolls under the toolbar. */
.people-section__letter {
  position: sticky;
  z-index: 2;
  top: calc(var(--topbar-h) + var(--safe-top));
  align-self: flex-start;
  min-width: 28px;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: var(--mat-thin);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  color: var(--text-2);
  font-size: var(--type-subhead);
  font-weight: var(--fw-semibold);
  line-height: 18px;
  text-align: center;
}
.people-list {
  display: block;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 0 0 0.5px var(--card-ring), var(--shadow-xs), inset 0 0.5px 0 var(--card-highlight);
  list-style: none;
}
.person-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 12px 8px 16px;
  color: var(--text);
  transition: background-color var(--dur-1) ease;
}
.people-list > li + li > .person-row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 64px;
  height: 0.5px;
  background: var(--line);
}
@media (hover: hover) {
  .person-row:hover {
    background: var(--fill-1);
  }
}
.person-row:active {
  background: var(--fill-2);
}
.person-row:focus-visible {
  outline-offset: -3px;
}
.person-row__avatar.avatar {
  --size: 36px;
  font-size: 13px;
}
.person-row__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.person-row__name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: calc(0.9375rem * var(--text-scale));
  font-weight: var(--fw-semibold);
  line-height: 1.3;
}
.person-row__name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-row__role {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--c-orange-ink);
}
.person-row__role--admin {
  color: var(--accent-ink);
}
.person-row__you {
  flex-shrink: 0;
  color: var(--text-3);
  font-size: var(--type-footnote);
  font-weight: var(--fw-regular);
}
.person-row__guest {
  flex-shrink: 0;
}
.person-row__sub {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-2);
  font-size: var(--type-subhead);
  line-height: 1.35;
}
.person-row__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-row__teams {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
}
.person-row__team {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.person-row__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tone);
}
.person-row__more {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
@media (min-width: 640px) {
  .person-row__teams {
    display: inline-flex;
  }
  .person-row__teams::before {
    content: "·";
    color: var(--text-3);
  }
}
.person-row__trail {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: var(--type-body);
}
.person-row__open {
  min-width: 2ch;
  color: var(--text-2);
  text-align: right;
}
.person-row__overdue {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--danger) 13%, transparent);
  color: var(--danger-ink);
  font-size: var(--type-footnote);
  font-weight: var(--fw-semibold);
}
.person-row__chevron {
  color: var(--text-3);
  opacity: 0.7;
}
/* A–Я index (phones): a quiet accent strip on the right edge; tap or drag to jump. */
.people-index {
  display: none;
}
@media (max-width: 767px) {
  .people-book {
    padding-right: 14px;
  }
  .people-index {
    position: fixed;
    z-index: 5;
    top: 50%;
    right: max(2px, var(--safe-right));
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 0;
    transform: translateY(-50%);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
  .people-index__letter {
    display: grid;
    place-items: center;
    width: 20px;
    min-height: 17px;
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: var(--fw-semibold);
    line-height: 1;
  }
  .people-index__letter.is-current {
    transform: scale(1.35);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .people-section {
    animation: people-rise var(--dur-3) var(--ease-out) both;
  }
  .people-index__letter {
    transition: transform var(--dur-snappy) var(--spring-snappy);
  }
}
@media (max-width: 639px) {
  .person-row__chevron {
    display: none;
  }
  .person-row__trail {
    gap: 6px;
  }
}

/* -- r4 · 12.15: Person — a contact card ---------------------------------------------------------- */
.person-hero {
  gap: 6px;
  margin-bottom: var(--space-5);
}
.person-hero > .avatar {
  margin-bottom: 8px;
  box-shadow: 0 0 0 4px var(--bg), var(--shadow-md);
}
.person-hero__name {
  font-size: calc(1.75rem * var(--text-scale));
  font-weight: var(--fw-bold);
}
.person-hero__title {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--text-2);
  font-size: calc(0.9375rem * var(--text-scale));
}
/* Action tiles (iOS Contacts): message · assign · e-mail. */
.person-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.person-actions > li {
  flex: 0 1 96px;
  min-width: 64px;
}
.person-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 56px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 0.5px var(--card-ring), var(--shadow-xs);
  color: var(--accent-ink);
  transition: background-color var(--dur-1) ease, transform var(--dur-snappy) var(--spring-snappy);
}
.person-action .icon {
  color: var(--accent);
}
@media (hover: hover) {
  .person-action:hover {
    background: var(--surface-2);
  }
}
.person-action:active {
  transform: scale(0.95);
}
.person-action__label {
  max-width: 100%;
  overflow: hidden;
  font-size: var(--type-caption2);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Details — label ··· value rows in an inset group. */
.person-info {
  max-width: 680px;
  margin: 0 auto var(--space-6);
}
.person-info__group {
  margin: 0;
  padding: 0;
  list-style: none;
}
.person-info__row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--row-h-list);
  padding: 9px 16px;
  font-size: var(--type-body);
}
.person-info__group > li + li > .person-info__row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 16px;
  height: 0.5px;
  background: var(--line);
}
.person-info__label {
  flex-shrink: 0;
  color: var(--text-2);
}
.person-info__value {
  min-width: 0;
  margin-left: auto;
  overflow-wrap: anywhere;
  color: var(--text);
  text-align: right;
}
.person-info__value.link {
  color: var(--accent-ink);
}
.person-info__row--teams {
  align-items: flex-start;
}
.person-info__row--teams .person-info__label {
  padding-top: 3px;
}
.person-info .person-hero__teams {
  justify-content: flex-end;
  margin: 0;
}
@media (max-width: 479px) {
  .person-info__row--teams {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .person-info .person-hero__teams {
    justify-content: flex-start;
  }
}

/* -- r4 · 12.15: Teams — widget cards ------------------------------------------------------------- */
.team-grid {
  gap: 14px;
}
.team-card {
  gap: 10px;
  padding: 16px 16px 14px;
  border-radius: var(--radius-widget);
  box-shadow: 0 0 0 0.5px var(--card-ring), var(--shadow-sm), inset 0 0.5px 0 var(--card-highlight);
  transition:
    box-shadow var(--dur-2) ease,
    transform var(--dur-snappy) var(--spring-snappy);
}
@media (hover: hover) {
  .team-card:hover {
    box-shadow: 0 0 0 0.5px var(--line), var(--shadow-md);
    transform: translateY(-1px);
  }
}
.team-card:active:not(:has(.team-card__action:active)) {
  transform: scale(0.99);
}
.team-card__head {
  align-items: flex-start;
}
.team-card__titles {
  padding-top: 3px;
}
.team-card__name {
  font-size: var(--type-headline);
  letter-spacing: var(--tracking-snug, 0);
}
.team-card__meta {
  font-size: var(--type-footnote);
}
.team-card__desc {
  min-height: calc(2 * 1.45em);
  font-size: var(--type-subhead);
  line-height: 1.45;
}
.team-card__foot {
  padding-top: 0;
  border-top: 0;
}
.team-card__foot .btn--secondary {
  background: var(--fill-1);
  box-shadow: none;
}

/* Team page: the identity header sits on the page (no card), like a contact card. */
.team-hero {
  gap: var(--space-4);
  padding: 4px 0;
  background: none;
  box-shadow: none;
}
.team-hero__name {
  font-size: var(--type-title1);
}
.team-hero__desc {
  font-size: calc(0.9375rem * var(--text-scale));
}
.team-hero .icon-tile--xl {
  box-shadow:
    inset 0 0.5px 0 rgb(255 255 255 / 0.35),
    inset 0 0 0 0.5px rgb(0 0 0 / 0.06),
    var(--shadow-md);
}
@media (max-width: 479px) {
  .team-hero {
    align-items: center;
    padding: 4px 0;
    text-align: center;
  }
  .team-hero__text {
    align-items: center;
  }
  .team-hero__meta {
    justify-content: center;
  }
  .team-hero__add-desc {
    align-self: center;
  }
}
.team-project.card {
  border-radius: var(--radius-widget);
}

/* -- r4 · 12.19: Sign-in pages — wallpaper + glass card ------------------------------------------- */
.auth__bg {
  --mesh-a: 18%;
  --mesh-b: 14%;
  background: var(--bg);
}
:root[data-scheme="dark"] .auth__bg {
  --mesh-a: 22%;
  --mesh-b: 16%;
}
.auth__bg::before {
  inset: -12%;
  background:
    radial-gradient(44% 48% at 18% 20%, color-mix(in srgb, var(--accent) var(--mesh-a), transparent), transparent 70%),
    radial-gradient(42% 46% at 84% 28%, color-mix(in srgb, var(--c-teal) var(--mesh-b), transparent), transparent 70%),
    radial-gradient(50% 52% at 58% 88%, color-mix(in srgb, var(--c-purple) var(--mesh-b), transparent), transparent 70%);
  filter: blur(60px);
  animation: none;
}
.auth__bg::after {
  display: none;
}
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduced"]) .auth__bg::before {
    animation: auth-drift 40s ease-in-out infinite alternate;
  }
}
@keyframes auth-drift {
  from {
    transform: translate3d(-4%, -3%, 0) scale(1);
  }
  to {
    transform: translate3d(4%, 3%, 0) scale(1.05);
  }
}
/* Top bar: brand on the left, language + theme in one glass capsule. */
.auth__tools {
  gap: 2px;
  padding: 3px;
  border: 0.5px solid var(--glass-border);
  border-radius: var(--radius-full);
  background: var(--glass-sheen), var(--mat-thin);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  box-shadow: var(--glass-rim), var(--shadow-sm);
}
.auth__tools .lang-switch {
  padding: 0;
  background: none;
}
/* The card: regular glass, rim, a big soft shadow. */
.auth-card {
  max-width: 400px;
  padding: 32px 28px 28px;
  border: 0;
  border-radius: 28px;
  background: var(--glass-sheen), var(--mat-regular);
  -webkit-backdrop-filter: var(--mat-filter-strong);
  backdrop-filter: var(--mat-filter-strong);
  box-shadow: var(--glass-rim), 0 0 0 0.5px var(--glass-border), var(--shadow-xl);
}
.people-auth--wide .auth-card {
  max-width: 520px;
}
.auth-card__head {
  gap: 6px;
  margin-bottom: 24px;
}
.auth-card__logo {
  display: block;
  width: 72px;
  height: 72px;
  margin-bottom: 10px;
  border-radius: 18px;
  filter: drop-shadow(0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent));
}
/* Pages with their own art (status, invitation, envelope) do not repeat the app icon. */
.auth-card:has(.auth-status__art, .invite-card, .envelope, .auth-invite, .ob-progress, .ws-identity) .auth-card__logo {
  display: none;
}
.auth-card__title {
  font-size: var(--type-title1);
  font-weight: var(--fw-bold);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.auth-card__subtitle {
  color: var(--text-2);
  font-size: calc(0.9375rem * var(--text-scale));
  line-height: 1.4;
  text-wrap: balance;
}
.auth-forgot {
  margin-top: -4px;
  font-size: var(--type-subhead);
  text-align: center;
}
/* Phones: no card — the content sits on the wallpaper with 24 px edges. */
@media (max-width: 479px) {
  .auth {
    padding-inline: max(8px, var(--safe-left)) max(8px, var(--safe-right));
  }
  .auth-card {
    padding: 8px 16px 0;
    border-radius: 0;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }
  .auth__main {
    justify-content: flex-start;
    padding-top: var(--space-6);
  }
  .auth-card__logo {
    width: 64px;
    height: 64px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduced"]) .auth-card {
    animation: auth-card-in var(--dur-smooth) var(--spring-smooth) both;
  }
}
@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

/* Merged fields (Apple ID): one inset group, borderless 48 px rows, a hairline between them.
   Labels stay for screen readers; the placeholder + glyph name the row. Errors sit inside the row. */
.auth-fields {
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 0.5px var(--line-strong), var(--shadow-xs);
  transition: box-shadow var(--dur-2) ease;
}
.auth-fields:focus-within {
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--focus-ring), var(--shadow-xs);
}
.auth-fields > .field {
  position: relative;
  gap: 0;
}
.auth-fields > .field + .field::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  left: 44px;
  height: 0.5px;
  background: var(--line);
}
.auth-fields .field__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.auth-fields .input-icon > .input {
  height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: var(--type-body);
}
.auth-fields .input-icon > .input:focus,
.auth-fields .input-icon > .input:focus-visible {
  outline: none;
  box-shadow: none;
}
.auth-fields .field--invalid .input-icon > .input {
  background: color-mix(in srgb, var(--danger) 6%, transparent);
}
.auth-fields .field__error,
.auth-fields .field__help {
  padding: 0 16px 10px 44px;
}
.auth-fields + .pw-meter {
  margin-top: -8px;
}
@media (max-width: 479px) {
  .auth-fields {
    border-radius: var(--radius-card);
  }
}

/* Password strength — a 4-segment capsule (red → orange → yellow → green), 12 px note under it. */
.pw-meter__bars {
  gap: 3px;
  overflow: hidden;
  border-radius: var(--radius-full);
}
.pw-meter__bars span {
  height: 5px;
  border-radius: 0;
  background: var(--fill-2);
}
.pw-meter[data-score="0"] .pw-meter__bars span:nth-child(-n + 1),
.pw-meter[data-score="1"] .pw-meter__bars span:nth-child(-n + 1) {
  background: var(--c-red);
}
.pw-meter[data-score="2"] .pw-meter__bars span:nth-child(-n + 2) {
  background: var(--c-orange);
}
.pw-meter[data-score="3"] .pw-meter__bars span:nth-child(-n + 3) {
  background: var(--c-yellow);
}
.pw-meter[data-score="4"] .pw-meter__bars span {
  background: var(--c-green);
}
.pw-meter__label {
  padding-inline: 2px;
  font-size: var(--type-footnote);
}
.pw-meter[data-score="3"] .pw-meter__label {
  color: var(--text-2);
}

/* OTP — six 48×56 cells, radius 12; focus = accent ring; a typed digit pops (spring). */
.otp__cell {
  width: clamp(38px, 11vw, 48px);
  height: 56px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  font-size: 26px;
  box-shadow: 0 0 0 0.5px var(--line-strong), var(--shadow-xs);
}
.otp__cell:focus {
  border: 0;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px var(--focus-ring);
}
.otp.is-error .otp__cell {
  box-shadow: 0 0 0 1px var(--danger);
}
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduced"]) .otp__cell.is-filled {
    animation: otp-digit var(--dur-snappy) var(--spring-snappy);
  }
}
@keyframes otp-digit {
  from {
    transform: scale(0.86);
  }
}

/* Status pages (e-mail sent, reset done, closed sign-up…): an app-icon squircle like an empty state. */
.auth-status__art {
  width: 64px;
  height: 64px;
  margin-top: 0;
  margin-bottom: 4px;
  border-radius: 16px;
  background: var(--tone-gradient);
  color: var(--tone-on);
  box-shadow:
    inset 0 0.5px 0 rgb(255 255 255 / 0.35),
    inset 0 0 0 0.5px rgb(0 0 0 / 0.06),
    var(--shadow-md);
}
.auth-status__art .icon {
  --icon-stroke: 2;
  width: 32px;
  height: 32px;
}
.auth-status__text {
  font-size: calc(0.9375rem * var(--text-scale));
}
.auth-invite {
  border-radius: 14px;
  background: var(--fill-1);
}
/* Status pages: the icon leads, then the title and the text (empty-state order). */
.auth-card:has(> .auth-status > :is(.auth-status__art, .envelope)) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.auth-card:has(> .auth-status > :is(.auth-status__art, .envelope)) > .auth-card__head {
  margin-bottom: 0;
}
.auth-card > .auth-status:has(> :is(.auth-status__art, .envelope)) {
  display: contents;
}
.auth-card > .auth-status > :is(.auth-status__art, .envelope) {
  order: -1;
}
/* Section heads with an action (Joining): the explanation aligns with the 16 px group inset. */
.people-settings .access-section__text {
  padding: 0 16px;
  color: var(--text-3);
  font-size: var(--type-footnote);
}

/* -- r4 · 12.18: Two-factor — QR in a white 180 px card (radius 14); codes mono 15 px on fill-1 --- */
.qr-code {
  width: 180px;
  height: 180px;
  padding: 12px;
  border-radius: 14px;
  box-shadow: 0 0 0 0.5px var(--card-ring), var(--shadow-md);
}
.recovery-codes {
  border: 0;
  border-radius: var(--radius-card);
  background: var(--fill-1);
}
.recovery-codes__item {
  font-size: 15px;
}
/* OTP cells on a settings card: a filled well, so they read on the card in both themes. */
.people-settings .otp__cell {
  background: var(--fill-1);
  box-shadow: inset 0 0 0 0.5px var(--line);
}
.people-settings .otp__cell:focus {
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px var(--focus-ring);
}
/* Reduce transparency: no blur anywhere — the wallpaper keeps its soft gradients unblurred. */
:root[data-transparency="reduced"] .auth__bg::before {
  filter: none;
}
@media (prefers-reduced-transparency: reduce) {
  .auth__bg::before {
    filter: none;
  }
}
