/* Settings and admin pages: account menu, tabs, table toolbars, pagination, detail lists. */

/* ---- Account menu ---- */
.avatar {
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--lg {
  width: 56px;
  height: 56px;
  margin: 0;
  font-size: 22px;
}

.avatar--square {
  border-radius: 12px;
  background: var(--blue-wash);
  color: var(--blue);
}

/* Logos keep their whole shape instead of being cropped to fill the square. */
.avatar--square img {
  object-fit: contain;
  background: var(--surface);
}

.settings-section__fields .photo-picker {
  margin: 0 0 8px;
}

.avatar--xl {
  width: 80px;
  height: 80px;
  margin: 0;
  font-size: 32px;
}

.account-menu {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + var(--app-bar-h) - 4px);
  right: 8px;
  z-index: 55;
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(360px, calc(100vw - 16px));
  padding: 16px 16px 12px;
  border-radius: 24px;
  background: #e9eef6;
  box-shadow: var(--shadow-raised);
  text-align: center;
}

.account-menu__email {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.account-menu__greeting {
  margin: 0;
  font-size: 22px;
  line-height: 28px;
}

.account-menu .btn--pill {
  background: transparent;
  border-color: var(--ink-3);
}

.account-menu__actions {
  display: grid;
  width: 100%;
  margin-top: 4px;
}

.account-menu__action {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
}

.account-menu__action:hover {
  background: var(--field);
}

/* ---- Page sections ---- */
.page-stack {
  display: grid;
  gap: 24px;
  max-width: 960px;
}

.page-stack--wide {
  max-width: none;
}

/*
 * A form with its summary beside it: the form keeps its width, and the summary follows the page as
 * it scrolls. Below about 1180px there's no room for both, so the summary is left out.
 */
.editor-layout {
  display: grid;
  /* The form takes what is left so the card beside it sits against the edge of the page. */
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 24px;
  align-items: start;
}

.editor-summary {
  position: sticky;
  top: calc(var(--app-bar-h) + 20px);
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.editor-summary__head {
  display: grid;
  gap: 2px;
}

.editor-summary__kind {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

.editor-summary__number {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
}

/* Before the first save there is no number yet, only a note about it. */
.editor-summary__number.is-pending {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
}

.editor-summary__progress {
  display: grid;
  gap: 6px;
}

.editor-summary__progress-text {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

.editor-summary__track {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--grid);
}

.editor-summary__bar {
  display: block;
  block-size: 100%;
  inline-size: 0;
  border-radius: 3px;
  background: var(--blue);
  transition: inline-size 200ms ease;
}

.editor-summary__list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.editor-summary__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.editor-summary__mark {
  flex: none;
  color: var(--ink-3);
  font-size: 20px;
}

.editor-summary__item.is-done .editor-summary__mark {
  color: var(--good);
  font-variation-settings: "FILL" 1;
}

.editor-summary__text {
  display: grid;
  min-width: 0;
}

.editor-summary__label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 16px;
}

.editor-summary__label .ms {
  font-size: 16px;
}

.editor-summary__value {
  color: var(--ink-3);
  line-height: 20px;
  overflow-wrap: anywhere;
}

.editor-summary__item.is-done .editor-summary__value {
  color: var(--ink);
}

.editor-summary__extras {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--grid);
  color: var(--ink-2);
  font-size: 13px;
}


@media (max-width: 1180px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-summary {
    display: none;
  }
}

.is-loading {
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.notice--inset {
  margin: 0 20px 16px;
}

.card__intro {
  margin: 16px 20px 8px;
  color: var(--ink-2);
}

.card__body--form {
  padding: 16px 24px 24px;
}

.card__body--form form {
  max-width: 560px;
}

.card__body p {
  max-width: 72ch;
}

.setup-steps {
  display: grid;
  gap: 20px;
  max-width: 600px;
  margin: 0;
  padding-left: 20px;
}

.setup-steps li::marker {
  color: var(--ink-2);
  font-weight: 500;
}

.setup-steps p {
  margin: 0 0 8px;
}

.invite-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0 16px;
  max-width: 640px;
}

.invite-row .field {
  flex: 1 1 280px;
}

.invite-row .btn {
  margin-top: 10px;
}

.back-link {
  margin-left: -8px;
}

/* A settings row: label, value and an action, as on GA's property details. */
.detail-list {
  margin: 0;
}

.detail-list__row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 24px;
  min-height: 56px;
  padding: 10px 20px;
  border-top: 1px solid var(--grid);
}

.detail-list__row:first-child {
  border-top: 0;
}

/* Shorter rows with a narrower label column, for a card of facts beside another card. */
.detail-list--compact .detail-list__row {
  grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) auto;
  min-height: 44px;
  padding-block: 8px;
}

.detail-list dt {
  color: var(--ink-2);
}

.detail-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

/* Several values in one row, such as a contact's phone above their email. */
.detail-lines {
  display: grid;
  gap: 2px;
}

@media (max-width: 640px) {
  .detail-list__row {
    grid-template-columns: 1fr auto;
  }

  .detail-list dt {
    grid-column: 1 / -1;
  }
}

/* ---- System settings: a heading on the left and fields on the right, as in GA's admin ---- */
.settings-section {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 560px);
  gap: 12px 40px;
  padding: 24px;
  border-top: 1px solid var(--grid);
}

.settings-section:first-of-type {
  border-top: 0;
}

/* Parts of one thing being written, rather than separate settings: no rule between them. */
.settings-section--plain {
  border-top: 0;
  padding-top: 0;
}

/* A button under the text on the left of a section, with room between them. */
.settings-section__button {
  margin-top: 12px;
}

.settings-section__title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
}

.settings-section__text {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 18px;
}

.settings-section__fields,
.settings-section__fields > .form-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.card > .form-error {
  margin: 16px 24px 0;
}

@media (max-width: 800px) {
  .settings-section {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 16px;
  }
}

/* ---- Organization form: one form card with a live preview beside it ---- */
.org-form {
  display: grid;
  gap: 20px;
  max-width: 1160px;
}

.org-form__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.org-form__main {
  min-width: 0;
}

.org-form__fields {
  display: grid;
  gap: 4px;
  padding: 20px 24px 16px;
}

.org-form .field__input {
  scroll-margin: 120px 0;
}

.form-card__header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px 0;
}

.form-card__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-wash);
  color: var(--blue);
}

.form-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  line-height: 24px;
}

.form-card__subtitle {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 18px;
}

.form-card__body {
  display: grid;
  gap: 4px;
  padding: 20px 24px 16px 80px;
}

.form-row--wide-first {
  grid-template-columns: minmax(0, 3fr) minmax(160px, 2fr);
}

.field__helper--split {
  text-align: right;
}

.coming-soon {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.coming-soon__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
}

.coming-soon__title {
  margin: 0;
  font-weight: 500;
}

.coming-soon__text {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 18px;
}

.coming-soon__chip {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.org-form__aside {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--app-bar-h) + 20px);
  display: grid;
  gap: 12px;
}

/* The Basic tab keeps the same main-card width as Communications, with the preview beside it. */
.org-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: start;
  max-width: 1304px;
}

.org-settings__main {
  display: grid;
  flex: 1 1 960px;
  gap: 20px;
  min-width: 0;
  max-width: 960px;
}

.org-settings__notice {
  flex: 0 0 100%;
}

.org-settings__aside {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--app-bar-h) + 20px);
  display: grid;
  flex: 0 1 320px;
  gap: 12px;
  min-width: 0;
}

.org-preview__banner {
  height: 72px;
  background: linear-gradient(135deg, var(--blue-wash), var(--blue-track));
}

.org-preview__content {
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 0 20px 20px;
}

.org-preview__logo {
  margin: -40px 0 8px;
  border: 4px solid var(--surface);
  box-sizing: content-box;
}

.org-preview__label {
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.org-preview__name {
  margin: 0;
  font-size: 20px;
  font-weight: 400;
  line-height: 28px;
  overflow-wrap: anywhere;
}

.org-preview__name.is-placeholder {
  color: var(--ink-3);
}

.org-preview__legal {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

.org-preview__description {
  margin: 8px 0 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.org-preview__facts {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--grid);
  list-style: none;
}

.org-preview__facts li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.org-preview__facts .ms {
  color: var(--ink-3);
}

.org-preview__facts .org-preview__empty {
  display: block;
  color: var(--ink-3);
}

.org-preview__note {
  margin: 0;
  padding: 0 4px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 16px;
}

.card__footer-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .org-form__layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .org-form__aside {
    display: none;
  }
}

@media (max-width: 640px) {
  .form-card__header {
    padding: 16px 16px 0;
  }

  .org-form__fields,
  .form-card__body {
    padding: 16px 16px 12px;
  }

  .form-row--wide-first {
    grid-template-columns: minmax(0, 1fr);
  }

  .coming-soon {
    flex-wrap: wrap;
  }

  .coming-soon__chip {
    margin-left: 52px;
  }

  /* On a narrow screen the buttons take the row and the hint gets out of the way. */
  .card__footer-note {
    display: none;
  }

}

/* ---- Roles: the permission matrix ---- */
.toolbar__text {
  margin: 0;
  color: var(--ink-2);
}

.role-permissions {
  border-top: 1px solid var(--grid);
}

.permission-matrix td {
  vertical-align: top;
}

.permission-matrix__resource {
  display: grid;
  gap: 2px;
  min-width: 170px;
  padding-top: 2px;
}

.permission-matrix__module {
  color: var(--ink-2);
  font-size: 12px;
}

.permission-matrix__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
}

.check.permission-matrix__action {
  display: inline-grid;
  grid-template-columns: 18px auto;
  column-gap: 10px;
  align-items: center;
  white-space: nowrap;
}

.check.permission-matrix__action input:disabled {
  cursor: default;
  opacity: 0.38;
}

/* An action that narrows a role rather than widening it, such as "Only assigned projects". */
.check.permission-matrix__action--limit span {
  color: var(--ink-2);
  font-style: italic;
}

/* It has nothing to narrow until View is ticked, so until then it is out of play. */
.check.permission-matrix__action--limit.is-waiting span {
  color: var(--ink-3);
}

/* ---- Profile header on the user detail page ---- */
.profile-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.profile-header__text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 200px;
}

.profile-header__name {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  line-height: 28px;
}

.profile-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  color: var(--ink-2);
}

.profile-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  height: 48px;
  padding: 0 20px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
}

/* Tabs that each have their own address are links. */
a.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

/*
 * A tab the job has not reached yet. A project is made in order — something to work from, then the
 * people it needs — and until it has those there is nothing on the later tabs to look at, so they
 * are shown greyed rather than hidden: the shape of the job stays visible while it is being made.
 */
span.tab--shut {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  opacity: 0.45;
  cursor: not-allowed;
}

.tab--shut:hover {
  background: none;
  color: var(--ink-3);
}

.tab:hover {
  background: var(--hover);
  color: var(--ink);
}

.tab[aria-selected="true"],
.tab[aria-current="page"] {
  color: var(--blue);
}

.tab[aria-selected="true"]::after,
.tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
}

.tab:focus-visible {
  outline-offset: -2px;
}

/* ---- Table toolbar and pagination ---- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

/* A box with the magnifier inside it, like the other fields on the page. */
.table-search {
  display: flex;
  flex: 1 1 240px;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink-2);
}

.table-search:focus-within {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.table-search .ms {
  font-size: 20px;
}

.table-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
}

.filter-select {
  height: 36px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z' fill='%235f6368'/%3E%3C/svg%3E") no-repeat right 4px center;
  color: var(--ink);
  appearance: none;
  cursor: pointer;
}

.filter-select:hover {
  border-color: var(--ink-3);
}

.toolbar__end {
  margin-left: auto;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 24px;
  padding: 6px 12px 6px 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
}

.pagination__size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination__select {
  padding: 4px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.pagination__buttons {
  display: flex;
}

.icon-btn:disabled {
  background: none;
  cursor: default;
  opacity: 0.38;
}

.table-link {
  color: var(--blue);
  font-weight: 500;
}

/* A count or hint between a toolbar and its table. */
.table-note {
  margin: 0;
  padding: 4px 24px 12px;
  border-top: 1px solid var(--grid);
  color: var(--ink-2);
  font-size: 13px;
}

/* People or things listed inside one detail row, each with a line of detail under it. */
.plain-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list > li {
  display: grid;
  gap: 2px;
}

/* Text someone typed on several lines keeps its line breaks. */
.pre-line {
  white-space: pre-line;
}

.table-secondary {
  display: block;
  color: var(--ink-2);
  font-size: 12px;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--field);
  font-family: "Roboto Mono", ui-monospace, Consolas, monospace;
  font-size: 13px;
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 12px;
  border-top: 1px solid var(--line);
}
