#people-open,
#push-toggle,
#agenda-open,
#new-person {
  min-height: 40px;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--brand-hover);
  font-size: 14px;
  font-weight: 650;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

#people-open,
#push-toggle,
#agenda-open { position: relative; white-space: nowrap; padding: 8px 12px; }
#push-toggle.is-on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-hover); }
#new-person { width: 100%; justify-content: flex-start; padding: 10px 14px; }
#people-open:hover,
#push-toggle:hover,
#agenda-open:hover,
#new-person:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-hover); }
#people-open:active,
#push-toggle:active,
#agenda-open:active,
#new-person:active { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; transform: translateY(1px); }
#people-open:focus-visible,
#push-toggle:focus-visible,
#agenda-open:focus-visible,
#new-person:focus-visible,
.assignee-open:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
#people-open:disabled,
#push-toggle:disabled,
#agenda-open:disabled,
#new-person:disabled { opacity: .55; cursor: not-allowed; }

#people-dialog,
#assignee-dialog {
  width: min(560px, 94vw);
  max-height: min(90dvh, 760px);
  padding: 20px;
  overflow: hidden;
  flex-direction: column;
  gap: 12px;
}
#people-dialog[open],
#assignee-dialog[open] { display: flex; }
#people-dialog .people-title,
#assignee-dialog .people-title { flex: none; align-items: flex-start; gap: 12px; margin: 0; }
#people-dialog .people-title > div,
#assignee-dialog .people-title > div { min-width: 0; }
#people-dialog .people-title h2,
#assignee-dialog .people-title h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 0; }
#people-dialog .people-title p,
#assignee-dialog .people-title p { margin: 6px 0 0; font-size: 13px; line-height: 1.45; }
#people-dialog .people-title .close,
#assignee-dialog .people-title .close { flex: none; width: 44px; height: 44px; padding: 0; }
.count { display: inline-flex; min-width: 28px; min-height: 24px; align-items: center; justify-content: center; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-hover); font-size: 12px; }

.people-list,
.assignee-list { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.people-list { max-height: min(58dvh, 520px); border-top: 1px solid var(--border); }
.people-empty { margin: 0; padding: 24px 16px; border-radius: var(--radius-md); background: var(--neutral-bg); color: var(--muted); text-align: center; line-height: 1.5; }

/* Person identity shared by the people manager and assignee selector. */
.avatar {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .02em;
}
.avatar-tone-0 { background: #245b84; }
.avatar-tone-1 { background: #17634f; }
.avatar-tone-2 { background: #68428a; }
.avatar-tone-3 { background: #8a4b20; }
.avatar-tone-4 { background: #315c42; }
.avatar-tone-5 { background: #74404c; }
.avatar-tone-6 { background: #3d4f86; }
.avatar-tone-7 { background: #596020; }
.avatar-tone-8 { background: #155e75; }
.avatar-tone-9 { background: #9f1239; }
.avatar-tone-10 { background: #115e59; }
.avatar-tone-11 { background: #92400e; }
.avatar-tone-12 { background: #075985; }
.avatar-tone-13 { background: #86198f; }
.avatar-tone-14 { background: #3f6212; }
.avatar-tone-15 { background: #334155; }
.person-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  min-width: 0;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.person-main { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.person-main strong { overflow-wrap: anywhere; color: var(--ink); font-size: 14px; font-weight: 650; }
.person-main > span { overflow-wrap: anywhere; color: var(--subtle); font-size: 12px; line-height: 1.4; }
.person-row .person-status { justify-self: start; border-radius: 999px; padding: 5px 9px; font-size: 11px; line-height: 1.3; white-space: nowrap; }
.person-status.confirmed { background: var(--success-bg); color: var(--success-ink); }
.person-status.pending { background: var(--warn-bg); color: var(--warn-ink); }
.person-row .person-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.person-actions button { min-height: 44px; padding: 8px 10px; font-size: 12px; }

.assignee-search { flex: none; gap: 6px; }
.assignee-search[hidden] { display: none; }
.assignee-search input { min-height: 44px; font-size: 16px; }
.assignee-list { max-height: min(60dvh, 560px); }
.assignee-option {
  width: 100%;
  min-height: 64px;
  grid-template-columns: 40px minmax(0, 1fr) 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.assignee-option:hover,
.assignee-option:focus-visible { outline: none; background: var(--neutral-bg); }
.assignee-option:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
.assignee-option.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.assignee-option.is-selected:hover,
.assignee-option.is-selected:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
.assignee-option.is-selected:hover { box-shadow: inset 0 0 0 1px var(--brand-hover); }
.assignee-option .selection-mark { display: flex; width: 24px; height: 24px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; color: transparent; }
.assignee-option.is-selected .selection-mark { border-color: var(--brand-hover); background: var(--brand-hover); color: #fff; }
.assignee-option .person-main strong { font-size: 14px; }
.assignee-empty { margin: 0; padding: 20px 8px; color: var(--muted); text-align: center; }

.assignee-field { gap: 8px; }
.assignee-native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}
.assignee-control { display: flex; min-width: 0; align-items: center; gap: 8px; }
.assignee-open { width: 100%; min-height: 44px; justify-content: flex-start; border: 1px solid var(--border); padding: 10px 14px; background: var(--surface); }
.assignee-open:hover { border-color: var(--brand); background: var(--brand-soft); }
.assignee-open.has-error { border-color: #b91c1c; color: #b91c1c; box-shadow: 0 0 0 1px #b91c1c; }
.assignee-chip { display: flex; min-width: 0; flex: 1; align-items: center; gap: 8px; }
.assignee-chip[hidden] { display: none; }
.assignee-chip .avatar { width: 32px; height: 32px; font-size: 11px; }
.assignee-chip strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.assignee-chip button { min-height: 44px; flex: none; padding: 8px 12px; color: var(--brand-hover); }
.assignee-chip button:hover { background: var(--brand-soft); }
.assignee-control.has-selection .assignee-open { display: none; }
#form-error { min-height: 0; }

.due-control { display: flex; min-width: 0; align-items: center; gap: 8px; }
.due-control input { width: auto; min-width: 0; flex: 1 1 auto; }
.due-remove { min-height: 40px; flex: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--muted); transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease; }
.due-remove[hidden] { display: none; }
.due-remove:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.due-remove:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
.due-remove:active { background: var(--brand-soft); transform: translateY(1px); }
.due-hint { color: var(--subtle); font-size: 12px; line-height: 1.35; }
.due-hint[hidden] { display: none; }
.task-sub .task-due { flex: none; color: var(--subtle); font-size: 11px; white-space: nowrap; }

.check-field {
  display: flex;
  min-height: 44px;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}
.check-field:hover { border-color: var(--brand); background: var(--brand-soft); }
.check-field input[type="checkbox"] { width: 18px; height: 18px; flex: none; margin: 0; accent-color: var(--brand); }
.check-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.due-control input:disabled { cursor: not-allowed; opacity: .58; }

.btn-danger,
.btn-edit {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.btn-danger { border-color: color-mix(in srgb, var(--late-ink) 35%, transparent); background: transparent; color: var(--late-ink); }
.btn-danger:hover { border-color: var(--late-ink); background: var(--late-bg); color: var(--late-ink); }
.btn-danger:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--late-ink); }
.btn-danger:active { background: color-mix(in srgb, var(--late-ink) 12%, var(--late-bg)); transform: translateY(1px); }
.btn-edit { border-color: color-mix(in srgb, var(--brand) 35%, transparent); background: transparent; color: var(--brand); }
.btn-edit:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-hover); }
.btn-edit:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
.btn-edit:active { background: var(--brand-soft); transform: translateY(1px); }
.btn-danger:disabled,
.btn-edit:disabled { opacity: .55; cursor: not-allowed; }
.task-icon.btn-danger,
.task-icon.btn-edit { width: 22px; min-height: 18px; height: 18px; padding: 0; border: 0; border-radius: 6px; background: transparent; }
.task-icon.btn-danger { color: color-mix(in srgb, var(--late-ink) 70%, var(--subtle)); }
.task-icon.btn-danger:hover { background: var(--late-bg); color: var(--late-ink); }
.task-icon.btn-edit { color: var(--subtle); }
.task-icon.btn-edit:hover { background: var(--brand-soft); color: var(--brand-hover); }
.person-actions button.btn-danger,
.person-actions button.btn-edit { min-height: 44px; border-radius: var(--radius-sm); }

@media (max-width: 600px) {
  #people-open,
  #push-toggle,
  #agenda-open { min-height: 44px; padding: 8px 10px; font-size: 13px; }
  #people-dialog,
  #assignee-dialog {
    width: 100vw;
    max-width: none;
    max-height: 90dvh;
    margin: auto 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 20px 20px 0 0;
  }
  .people-list { max-height: 58dvh; }
  #new-person { min-height: 48px; position: sticky; top: 0; z-index: 1; }
  .person-row { grid-template-columns: 40px minmax(0, 1fr); gap: 8px 10px; padding: 12px 4px; }
  .person-row > .avatar { grid-column: 1; grid-row: 1 / 3; }
  .person-row > .person-main { grid-column: 2; grid-row: 1; }
  .person-row > .person-status { grid-column: 2; grid-row: 2; }
  .person-row .person-actions { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; }
  .person-actions button { min-height: 44px; }
  .assignee-option { grid-template-columns: 40px minmax(0, 1fr) 24px; }
  .assignee-list { max-height: 60dvh; }
  .assignee-control { flex-wrap: wrap; }
  .assignee-chip { flex-basis: 100%; }
  .due-control { align-items: stretch; flex-direction: column; }
  .due-remove { min-height: 44px; align-self: flex-end; }
}

@media (max-width: 420px) {
  header { padding-right: 12px; padding-left: 12px; }
  #account { gap: 4px; }
  #people-open,
  #push-toggle,
  #agenda-open { padding: 8px; font-size: 12px; }
  #push-toggle .push-label,
  #agenda-open .agenda-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #logout { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  #people-open,
  #push-toggle,
  #agenda-open,
  #new-person,
  .assignee-option,
  .due-remove,
  .check-field,
  .btn-danger,
  .btn-edit,
  .task-icon.btn-danger,
  .task-icon.btn-edit { transition: none; transform: none; }
}
