/* Account dialogs (js/account-ui.js), the same file in every app: copied from Pulse's page standard (dialogs, account dialog, search, pager, toast),
   scoped to dialog.atom-ui so each app's own .modal, .btn, .pager and .search-box rules never touch them. Every colour is a theme token (the theme section of the app's CSS).
   Change it in every app together, from Pulse. */
dialog.atom-ui {
  position: fixed !important;
  inset: 0 !important;
  display: none;
  flex-direction: column;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  width: min(440px, calc(100vw - 32px));
  max-width: none !important;
  height: fit-content !important;
  max-height: calc(100dvh - 32px) !important;
  margin: auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface) !important;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  font: var(--font);
  text-align: left;
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  backdrop-filter: none !important;
  z-index: auto;
}
dialog.atom-ui[open] {
  display: flex;
}
dialog.atom-ui::backdrop {
  background: var(--backdrop);
}
@media (prefers-reduced-motion: no-preference) {
  dialog.atom-ui[open] {
    animation: atom-ui-in .16s ease-out;
  }
}
@keyframes atom-ui-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(.99);
  }
}
dialog.atom-ui *,
dialog.atom-ui *::before,
dialog.atom-ui *::after {
  box-sizing: border-box;
  letter-spacing: normal;
  text-transform: none;
}
dialog.atom-ui .hidden {
  display: none !important;
}
dialog.atom-ui button,
dialog.atom-ui input,
dialog.atom-ui select,
dialog.atom-ui textarea {
  font: inherit;
  color: inherit;
}
dialog.atom-ui button {
  cursor: pointer;
}
dialog.atom-ui > .modal-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  min-height: 0;
  margin: 0;
  padding: var(--dialog-head-pad);
  border: 0;
  border-bottom: 1px solid var(--brand-hover);
  border-radius: 0;
  background: var(--brand);
}
dialog.atom-ui > .modal-header > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}
dialog.atom-ui > .modal-header h2 {
  margin: 0;
  color: var(--on-brand);
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
}
dialog.atom-ui > .modal-header p {
  margin: 0;
  color: var(--on-brand-soft);
  font-size: 12px;
}
dialog.atom-ui .modal-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 1px solid var(--on-brand-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--on-brand);
}
dialog.atom-ui .modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
dialog.atom-ui .modal-close:hover {
  background: var(--on-brand-hover);
}
dialog.atom-ui > .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow: auto;
}
dialog.atom-ui > .modal-actions {
  flex: none;
}
/* buttons (Pulse's .btn, .btn.secondary, .btn.danger) */
dialog.atom-ui .btn {
  height: var(--btn-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  padding: var(--btn-pad);
  font-size: var(--fs);
  font-weight: 600;
  white-space: nowrap;
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: none;
}
dialog.atom-ui .btn:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}
dialog.atom-ui .btn:disabled {
  opacity: .55;
  cursor: wait;
}
dialog.atom-ui .btn.secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
dialog.atom-ui .btn.secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
dialog.atom-ui > .modal-actions button.danger,
dialog.atom-ui > .modal-actions button.danger:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--on-brand);
}
dialog.atom-ui table {
  border-spacing: 0;
}

/* ---- account dialog (Pulse) ---- */
/* My profile, Login details, the password form and the row list Sync shares: the same #accountDialog and .kv-list in every app. Paste this block unchanged into css/<app>.css after the app's dialog section.
   Markup: <dialog id="accountDialog" class="modal account-dialog"> > .modal-header (#accountDialogTitle, #accountDialogSub, #closeAccountDialog) > #accountDialogBody.modal-body > #accountDialogActions.modal-actions (hidden when empty).
   Account menu: My profile, Login details, User management, Sync (opens js/sync.js's dialog), Settings, Logout (asks "Logout?" with the body <p class="confirm-text">Are you sure you want to logout?</p>, actions Cancel then the primary Logout).
   Row list (My profile, Login details, Sync): <div class="kv-list"> > <div class="kv-row"> > <span class="kv-label"><svg> icon + label</span> + <span class="kv-value">value, or "-", or the value and its button</span>; label left, value right, one line between rows.
   Menu: <div class="account-menu hidden" role="menu"> > button.account-menu-item (person icon "My profile"), button.account-menu-item (lock icon "Login details"), button#sync.account-menu-item (sync arrows "Sync"), button.account-menu-item (exit icon "Logout", class account-menu-logout: red text and icon); no divider.
   My profile: a row list: Created (how long ago), Name, Job title, Email, Mobile, City, Country, About; action Edit turns the rows into inputs in place (<form id="profileForm" class="profile-form"> around the same row list, each value an input.kv-input, About a textarea), Save sends only what changed. Each field is in one dialog only: what the login sends is in Login details.
   Login details (icons at, lock, shield, key): the Username value is <span>username</span> + button#copyUsernameBtn.profile-edit with a copy icon, aria-label "Copy username".
   Login details (subtitle "What you sign in with. Only the password can be changed."): a row list: Username, Password (lock icon; the value <span class="profile-secret">•••••••• (always 8)</span> + button#changePasswordBtn.profile-edit with a pencil, aria-label "Change password"), Role, Permissions (the ids as stored, comma separated, e.g. "136, 137, 138"; "None" when empty); only the password is editable.
   Password form (title "Update password", subtitle "Set a new password for your account."): <form id="passwordForm" class="account-form"> two .field (label + input), p.field-help, p.error#passwordError; actions: Cancel (back to Login details), then the primary "Update password" (form="passwordForm"); success closes it with the toast "Password updated." */
dialog.atom-ui {
  width: min(440px, calc(100vw - 32px));
}
dialog.atom-ui > .modal-body:empty {
  display: none;
}
dialog.atom-ui .confirm-text {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs);
}
dialog.atom-ui > .modal-body {
  padding: var(--dialog-pad);
  background: var(--surface);
  font-size: var(--fs);
}
dialog.atom-ui .kv-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs);
}
dialog.atom-ui .kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
}
dialog.atom-ui .kv-row:first-child {
  border-top: 0;
}
dialog.atom-ui .kv-label {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}
dialog.atom-ui .kv-label svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
dialog.atom-ui .kv-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}
/* My profile, editing in place: each row's value becomes an input, the label stays on the left */
dialog.atom-ui .kv-value:has(.kv-input) {
  flex: 1 1 auto;
}
dialog.atom-ui .kv-input {
  width: 100%;
  max-width: 260px;
  height: var(--control-h);
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  text-align: left;
}
dialog.atom-ui textarea.kv-input {
  height: auto;
  min-height: 64px;
  padding: 6px 10px;
  resize: vertical;
}
dialog.atom-ui .kv-input:focus {
  border-color: var(--brand);
  outline: 0;
  box-shadow: var(--ring);
}
dialog.atom-ui .profile-secret {
  letter-spacing: 2px;
}
dialog.atom-ui .profile-edit {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--brand-ink);
  cursor: pointer;
}
dialog.atom-ui .profile-edit:hover {
  background: var(--brand-soft);
}
dialog.atom-ui .profile-edit svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
dialog.atom-ui .account-form {
  display: grid;
  gap: 14px;
}
dialog.atom-ui .account-form .field {
  display: grid;
  gap: 6px;
  margin: 0;
}
dialog.atom-ui .account-form label {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs);
  font-weight: 600;
}
dialog.atom-ui .account-form textarea {
  width: 100%;
  min-height: 72px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  resize: vertical;
}
dialog.atom-ui .account-form input {
  width: 100%;
  height: var(--control-h);
  margin: 0;
  padding: var(--control-pad);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  font-weight: 400;
}
dialog.atom-ui .account-form input:focus,
dialog.atom-ui .account-form textarea:focus {
  border-color: var(--brand);
  outline: 0;
  box-shadow: var(--ring);
}
dialog.atom-ui .account-form .field-help {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}
dialog.atom-ui .account-form .error,
dialog.atom-ui .profile-form .error {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-sm);
}
dialog.atom-ui .account-form .error.hidden,
dialog.atom-ui .profile-form .error.hidden {
  display: none;
}
dialog.atom-ui .profile-form .error {
  margin-top: 10px;
}
dialog.atom-ui > .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: var(--dialog-actions-pad);
  border-top: 1px solid var(--line);
  background: var(--bg);
}
dialog.atom-ui > .modal-actions.hidden {
  display: none;
}
dialog.atom-ui > .modal-actions button {
  height: var(--btn-h);
  margin: 0;
  padding: var(--btn-pad);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  font-weight: 600;
  cursor: pointer;
}
dialog.atom-ui > .modal-actions button:hover {
  background: var(--surface-2);
}
dialog.atom-ui > .modal-actions button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}
dialog.atom-ui > .modal-actions button.primary:hover {
  background: var(--brand-hover);
}
dialog.atom-ui > .modal-actions button:disabled {
  opacity: .6;
  cursor: wait;
}
/* account menu (under the avatar): My profile, Login details, Sync, Logout (in red), no divider; the app positions it (its avatar wrapper is position: relative) */
dialog.atom-ui .account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: max-content;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
dialog.atom-ui .account-menu.hidden {
  display: none;
}
dialog.atom-ui .account-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 18px 0 11px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
dialog.atom-ui .account-menu-item:hover {
  background: var(--surface-2);
}
dialog.atom-ui .account-menu-logout {
  color: var(--danger);
}
dialog.atom-ui .account-menu-logout:hover {
  background: var(--danger-soft);
}
dialog.atom-ui .account-menu-item svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* dropdowns in this dialog (User management's status, My profile's Country): one arrow, clear of the right edge */
dialog.atom-ui select.kv-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5l4 4 4-4' fill='none' stroke='%235f6b7a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  cursor: pointer;
}
/* User management (account menu, people icon "User management"): the users of the app's role, a page at a time; #accountDialogBody > .users-manage >
   form.users-tools (the shared .search-box: Username or Name; select#usersStatus.kv-input All / Active / Inactive, button#usersClear.btn.users-clear "Clear filters") > .users-table-wrap > table.users-table (Created, ID, Username, Name, Role, Permissions (numbers as stored), Status: span.users-status.is-active or .is-inactive) > div.pager.users-pager (the shared pager) */
dialog.atom-ui:has(.users-manage) {
  width: min(920px, calc(100vw - 32px)); /* every column fits: Permissions, Username and Name wrap instead of scrolling sideways */
}
dialog.atom-ui .users-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
dialog.atom-ui .users-tools .search-box {
  flex: 1;
}
dialog.atom-ui .users-tools > select.kv-input {
  flex: 0 0 120px;
  max-width: none;
}
/* Clear filters at the right end, as on the app's own filter row: red tint while a filter is in use, grey and disabled otherwise */
dialog.atom-ui .users-tools .users-clear,
dialog.atom-ui .users-tools .users-clear:hover:not(:disabled) {
  flex: none;
  padding: 0 12px;
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
dialog.atom-ui .users-tools .users-clear:disabled {
  border-color: var(--line);
  background: var(--bg);
  color: var(--faint);
  opacity: 1;
  cursor: not-allowed;
}
/* the list's refresh (button.btn.secondary.users-refresh, icon only) and New user (users granted permission 138), after Clear filters */
dialog.atom-ui .users-tools .users-refresh {
  flex: none;
  width: var(--btn-h);
  padding: 0;
}
dialog.atom-ui .users-tools .users-refresh svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
dialog.atom-ui .users-tools .users-new {
  flex: none;
  padding: 0 12px;
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}
dialog.atom-ui .users-tools .users-new:hover {
  background: var(--brand-hover);
}
dialog.atom-ui .users-table-wrap {
  height: min(440px, 55vh); /* a fixed height: the dialog keeps its size while users load, so it never jumps */
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
dialog.atom-ui .users-table {
  width: 100%;
  table-layout: fixed; /* the columns keep their widths below; Username takes the rest */
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
dialog.atom-ui .users-table th,
dialog.atom-ui .users-table td {
  padding: var(--cell-pad);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
/* one line per user: a value longer than its column ends in "…" (the full text on hover); a click on it opens that cell to show it all, a second click closes it */
dialog.atom-ui .users-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
dialog.atom-ui .users-table td.is-open {
  white-space: normal;
  overflow-wrap: anywhere;
}
dialog.atom-ui .users-table td.is-cut {
  cursor: pointer;
}
dialog.atom-ui .users-table th:nth-child(1) { width: 96px; } /* Created */
dialog.atom-ui .users-table th:nth-child(2) { width: 56px; } /* ID */
dialog.atom-ui .users-table th:nth-child(4) { width: 18%; } /* Name */
dialog.atom-ui .users-table th:nth-child(5) { width: 52px; } /* Role */
dialog.atom-ui .users-table th:nth-child(6) { width: 15%; } /* Permissions */
dialog.atom-ui .users-table th:nth-child(7) { width: 84px; } /* Status */
dialog.atom-ui .users-table th:nth-child(8) { width: 64px; } /* Action */
dialog.atom-ui .users-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--brand-tint);
  color: var(--ink);
}
dialog.atom-ui .users-table tbody tr:last-child td {
  border-bottom: 0;
}
dialog.atom-ui .users-table-wrap[aria-busy="true"] tbody {
  opacity: 0.55; /* the next page or a new search: the rows on screen stay, dimmed, until the new ones arrive */
}
dialog.atom-ui .users-table .users-note {
  text-align: center;
  color: var(--muted);
}
dialog.atom-ui .users-table .users-note.error {
  color: var(--danger);
}
dialog.atom-ui .users-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
}
dialog.atom-ui .users-status.is-active {
  background: var(--success-soft);
  color: var(--success);
}
dialog.atom-ui .users-status.is-inactive {
  background: var(--surface-2);
  color: var(--muted);
}
/* Update user (permission 139): the Action column (th/td.users-row-action), whose ⋯ (button.users-action) opens #usersMenu, the account menu's look (.account-menu, .account-menu-item;
   Deactivate in red as .account-menu-logout) placed by the app under the ⋯ inside .users-manage, so the table's scroll never clips it; each item opens its form, whose Deactivate is .modal-actions button.danger */
dialog.atom-ui .users-manage {
  position: relative;
}
dialog.atom-ui .users-menu {
  position: absolute;
  z-index: 5;
}
dialog.atom-ui .users-table th.users-row-action,
dialog.atom-ui .users-table td.users-row-action {
  text-align: center;
}
dialog.atom-ui .users-table td.users-row-action {
  padding-top: 0;
  padding-bottom: 0;
}
dialog.atom-ui .users-table .users-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
dialog.atom-ui .users-table .users-action:hover,
dialog.atom-ui .users-table .users-action[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--ink);
}
dialog.atom-ui .users-table .users-action svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
dialog.atom-ui > .modal-actions button.danger,
dialog.atom-ui > .modal-actions button.danger:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
dialog.atom-ui .users-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* ---- search (Pulse) ---- */
/* every search box, the same in every app: one box that looks like an input. Markup: <div class="search-box"> > select.search-field (the one column searched, at the left) + input.search-input (with a placeholder)
   + button.search-clear (×) + button.search-submit (→, brand colour, so it reads as submit). It runs on Enter or →, never while typing; × empties the box and searches again (the shared click handler in js/app.js);
   × and → show only while the box has text (every search input has a placeholder, so :placeholder-shown means empty). The app only sets the box's width. */
dialog.atom-ui .search-box {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: var(--control-h);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
dialog.atom-ui .search-box:focus-within {
  border-color: var(--brand);
  box-shadow: var(--ring);
}
dialog.atom-ui .search-box select.search-field {
  flex: none;
  width: auto;
  max-width: 45%;
  height: 100%;
  margin: 0;
  padding: 0 22px 0 10px !important;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: var(--radius) 0 0 var(--radius);
  appearance: none;
  -webkit-appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 14 14'%3E%3Cpath d='M3 5l4 4 4-4' fill='none' stroke='%235f6b7a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 7px center;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: none;
  outline: none;
  cursor: pointer;
}
dialog.atom-ui .search-box input.search-input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  outline: none;
}
dialog.atom-ui .search-box .search-submit {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 28px;
  margin: 0 3px 0 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-ink);
  cursor: pointer;
}
dialog.atom-ui .search-box .search-submit:hover {
  background: var(--brand-soft);
  color: var(--brand-ink);
}
dialog.atom-ui .search-box .search-submit svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
/* the × and → in every search box (the same in every app): × between the text and the → search button, both shown only while the box has text
   (every search input has a placeholder, so :placeholder-shown means empty); it empties the box and searches again, like the search button */
dialog.atom-ui .search-clear {
  display: grid;
  flex: none;
  place-items: center;
  align-self: center;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
dialog.atom-ui .search-clear:hover {
  background: var(--surface-2);
  color: var(--ink);
}
dialog.atom-ui input:placeholder-shown + .search-clear,
dialog.atom-ui input:placeholder-shown ~ .search-submit {
  display: none !important; /* × and → show only while the box has text (Enter still searches an empty box) */
}
dialog.atom-ui .search-clear svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ---- pager (Pulse) ---- */
/* every Previous / Next in the app, the same block in Finance, MDM and Pulse: <div class="pager ..." role="group" aria-label="Pages"> > button.btn.secondary.pager-btn (aria-label "Previous page", left chevron) + span.pager-label ("Page N", or "Page N of M" when the total is known) + button.btn.secondary.pager-btn (aria-label "Next page", right chevron); the app only places the group */
dialog.atom-ui .pager .pager-btn {
  flex: 0 0 auto;
  width: var(--btn-h);
  padding: 0;
}
dialog.atom-ui .pager .pager-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
dialog.atom-ui .pager .pager-btn:disabled {
  background: var(--bg);
  color: var(--faint);
  border-color: var(--line);
  opacity: 1;
  cursor: not-allowed;
}
dialog.atom-ui .pager .pager-label {
  min-width: 54px;
  text-align: center;
  white-space: nowrap;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}

/* ---- toast (Pulse, js/toast.js) ---- */
/* The same notification in every app (js/toast.js builds it): paste this block unchanged into css/<app>.css; it uses the app's --ink, --on-brand, --success, --danger, --fs and --shadow-lg.
   Bottom right (centred on a phone), a dark box: a green check or a red !, the message (a #number in light green), an optional green open icon after a thin line, then a muted ×.
   It is a popover (top layer), so the browser's popover defaults are reset here. */
.toast {
  --toast-accent: #9fd9b6; /* light green, readable on the dark box */
  position: fixed;
  inset: auto 24px 24px auto;
  margin: 0;
  max-width: min(440px, calc(100vw - 32px));
  padding: 8px 8px 8px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--toast-bg);
  color: var(--on-brand);
  font-size: var(--fs);
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  overflow: visible;
}
.toast:popover-open {
  display: flex;
  align-items: center;
  gap: 10px;
}
@media (max-width: 600px) {
  .toast {
    inset: auto 16px 16px 16px;
    max-width: none;
  }
}
.toast-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--success);
}
.toast.error .toast-icon {
  background: var(--danger);
}
.toast-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.toast-icon-error,
.toast.error .toast-icon-ok {
  display: none;
}
.toast.error .toast-icon-error {
  display: block;
}
.toast-text {
  flex: 1;
  min-width: 0;
}
.toast-id {
  font-weight: 600;
  color: var(--toast-accent);
}
.toast-divider,
.toast-open {
  display: none;
}
.toast.has-open .toast-divider {
  display: block;
  flex: none;
  width: 1px;
  height: 18px;
  background: rgb(255 255 255 / 0.2);
}
.toast-btn {
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgb(255 255 255 / 0.55);
  cursor: pointer;
}
.toast-close,
.toast.has-open .toast-open {
  display: grid;
}
.toast-btn:hover,
.toast-btn:focus-visible {
  color: #fff;
  background: rgb(255 255 255 / 0.12);
}
.toast-open {
  color: var(--toast-accent);
  background: rgb(159 217 182 / 0.16);
}
.toast-open:hover,
.toast-open:focus-visible {
  color: var(--toast-accent);
  background: rgb(159 217 182 / 0.28);
}
.toast-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Settings (settings.js) and Account blocked (account.js): their own <dialog class="... modal">, kept clear of each app's .modal overlay rules,
   with the same --brand head and 32px × as every dialog ---- */
dialog.atom-settings.modal,
dialog.atom-account.modal {
  display: none;
  flex-direction: column;
  align-items: stretch !important;
  justify-content: flex-start !important;
  background: var(--surface) !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  animation: none;
}
dialog.atom-settings.modal[open],
dialog.atom-account.modal[open] {
  display: block;
}
:is(dialog.atom-settings, dialog.atom-account) > .modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 0;
  margin: 0;
  padding: var(--dialog-head-pad);
  border: 0;
  border-bottom: 1px solid var(--brand-hover);
  border-radius: 0;
  background: var(--brand);
}
:is(dialog.atom-settings, dialog.atom-account) > .modal-header > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}
:is(dialog.atom-settings, dialog.atom-account) > .modal-header h2 {
  margin: 0;
  color: var(--on-brand);
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
}
:is(dialog.atom-settings, dialog.atom-account) > .modal-header p {
  margin: 0;
  color: var(--on-brand-soft);
  font-size: 12px;
}
:is(dialog.atom-settings, dialog.atom-account) .modal-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 1px solid var(--on-brand-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--on-brand);
}
:is(dialog.atom-settings, dialog.atom-account) .modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
:is(dialog.atom-settings, dialog.atom-account) .modal-close:hover {
  background: var(--on-brand-hover);
}
