[hidden] {
  display: none !important;
}

input,
textarea,
select {
  color: var(--ink);
  font: inherit;
}

.identity-public-page {
  min-height: 100vh;
  background: var(--canvas);
}

.identity-public-header {
  display: flex;
  min-height: 7.5rem;
  align-items: center;
  padding: 2.4rem clamp(1.25rem, 5vw, 4rem);
}

.identity-brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
}

.identity-brand img {
  display: block;
  width: 8.75rem;
  height: auto;
}

.identity-public-main {
  display: flex;
  min-height: calc(100vh - 7.5rem);
  align-items: flex-start;
  justify-content: center;
  padding: clamp(1.25rem, 5vh, 3.5rem) 1.25rem 4rem;
}

.identity-auth-panel {
  width: min(100%, 27rem);
  padding: 2rem 2.1rem 2.15rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface);
  box-shadow: 0 0.7rem 2.6rem rgb(25 43 35 / 5%);
}

.identity-auth-heading {
  margin-bottom: 1.8rem;
}

.identity-auth-heading h1,
.identity-page-heading h1 {
  margin: 0;
  font-size: clamp(1.75rem, 2.4vw, 2.05rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.identity-auth-heading p {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.7;
}

.identity-form,
.settings-form,
.dialog-form {
  display: grid;
  gap: 1.15rem;
}

.identity-form__context {
  padding: 0.95rem 1rem;
  border-left: 3px solid var(--green);
  background: var(--green-soft);
}

.identity-form__context strong {
  font-size: 0.92rem;
  font-weight: 600;
}

.identity-form__context p {
  margin: 0.3rem 0 0;
  color: #52605a;
  font-size: 0.82rem;
  line-height: 1.6;
}

.form-field {
  display: grid;
  gap: 0.48rem;
}

.form-field label {
  color: #2e3532;
  font-size: 0.86rem;
  font-weight: 600;
}

.form-field input,
.form-field textarea {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.68rem 0.78rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  background: #fff;
  font-size: 0.9rem;
  line-height: 1.45;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-field textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.form-field input:hover,
.form-field textarea:hover {
  border-color: #b8bfbb;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgb(23 106 86 / 11%);
  outline: 0;
}

.form-field input[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
  border-color: #a3483d;
}

.form-field small {
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.55;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.primary-button {
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
}

.primary-button:hover {
  border-color: #115c49;
  background: #115c49;
}

.primary-button--compact {
  min-height: 2.55rem;
  padding-inline: 0.9rem;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: #303834;
}

.secondary-button:hover {
  border-color: var(--green-line);
  background: #f7f9f7;
  color: var(--green);
}

.danger-button {
  border: 1px solid #d8b8b3;
  background: #fff;
  color: #8b3f35;
}

.danger-button:hover {
  border-color: #bd7e75;
  background: #fdf7f6;
}

.text-button {
  min-height: 2.2rem;
  padding: 0.25rem;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 500;
}

.text-button:hover {
  color: var(--green);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.text-button:disabled {
  cursor: wait;
  opacity: 0.56;
}

.form-feedback {
  margin: 0;
  color: #963f35;
  font-size: 0.82rem;
  line-height: 1.6;
}

.form-feedback.is-success {
  color: var(--green);
}

.identity-result {
  padding: 0.25rem 0 0;
}

.identity-result h2 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 600;
}

.identity-result p {
  margin: 0.7rem 0 1.4rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.7;
}

.identity-noscript {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  margin: 0;
  padding: 0.8rem 1rem;
  border: 1px solid #d8b8b3;
  background: #fff;
  color: #8b3f35;
  text-align: center;
}

.identity-private-shell .sidebar-account-button.is-current {
  background: var(--green-soft);
  color: #1f2d29;
  text-decoration: none;
}

.identity-private-shell .sidebar-account-button [data-session-email] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-avatar {
  display: inline-flex;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid #d6e1dc;
  border-radius: 50%;
  background: #e7efeb;
  color: #285b4d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
}

.identity-avatar--mobile {
  width: 2.2rem;
  height: 2.2rem;
  font-size: 0.9rem;
}

html.is-sidebar-collapsed .sidebar-account-button .identity-avatar {
  position: static;
  width: 2.35rem;
  height: 2.35rem;
  overflow: visible;
  clip-path: none;
  white-space: normal;
}

.identity-main {
  display: block;
  max-width: 75rem;
  min-height: 100vh;
  padding-bottom: 4rem;
}

.identity-page-loading {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.identity-settings-page,
.identity-admin-page {
  width: 100%;
}

.identity-page-heading {
  display: flex;
  min-height: 2.7rem;
  align-items: center;
}

.identity-page-heading--with-action {
  width: min(100%, 58rem);
  justify-content: space-between;
  gap: 1rem;
}

.settings-stack {
  display: grid;
  width: min(100%, 46rem);
  margin-top: 2rem;
  gap: 1rem;
}

.settings-panel {
  padding: 1.35rem 1.45rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--surface);
}

.settings-panel--compact {
  padding-block: 1.15rem;
}

.settings-panel__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.settings-panel__heading--actions {
  align-items: center;
}

.settings-panel__heading h2,
.account-permissions h3 {
  margin: 0;
  color: #2a312e;
  font-size: 0.98rem;
  font-weight: 600;
}

.settings-panel__heading p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.6;
}

.status-label {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border: 1px solid #d6e1dc;
  border-radius: 999px;
  background: #f4f8f6;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 600;
}

.account-permissions {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.account-permissions h3 {
  font-size: 0.82rem;
}

.account-permissions ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0.7rem 0 0;
  padding: 0;
  gap: 0.45rem;
  list-style: none;
}

.account-permissions li {
  padding: 0.35rem 0.55rem;
  border-radius: 0.4rem;
  background: #f2f4f2;
  color: #515b56;
  font-size: 0.76rem;
}

.account-permissions li.is-empty {
  padding-inline: 0;
  background: transparent;
  color: var(--ink-soft);
}

.settings-admin-link {
  width: fit-content;
  margin-top: 1.15rem;
}

.settings-form {
  max-width: 25rem;
  margin-top: 1.2rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.impersonation-banner {
  display: flex;
  min-height: 3rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 2rem;
  border-bottom: 1px solid #d5bf88;
  background: #fff9ea;
  color: #604c1f;
  gap: 1rem;
}

.impersonation-banner p {
  margin: 0;
  font-size: 0.82rem;
}

.impersonation-banner button {
  min-height: 2rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid #c8ab69;
  border-radius: 0.4rem;
  background: #fff;
  color: #604c1f;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
}

.identity-back-link {
  margin-bottom: 1.1rem;
}

.identity-back-link a {
  color: var(--ink-soft);
  font-size: 0.82rem;
  text-decoration: none;
}

.identity-back-link a:hover {
  color: var(--green);
}

.admin-tabs {
  display: flex;
  width: min(100%, 58rem);
  margin-top: 1.75rem;
  border-bottom: 1px solid var(--line);
  gap: 1.5rem;
}

.admin-tabs button {
  position: relative;
  min-height: 2.7rem;
  padding: 0 0.1rem;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 500;
}

.admin-tabs button::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}

.admin-tabs button:hover,
.admin-tabs button.is-current {
  color: var(--green);
}

.admin-tabs button.is-current::after {
  background: var(--green);
}

.admin-tabs span {
  margin-left: 0.25rem;
  color: inherit;
  font-size: 0.72rem;
}

.admin-page-feedback,
.admin-loading,
.admin-panel {
  width: min(100%, 58rem);
}

.admin-page-feedback,
.admin-loading {
  margin-top: 1rem;
}

.admin-loading {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.admin-panel {
  padding-top: 1rem;
}

.admin-list {
  display: grid;
  gap: 0.65rem;
}

.admin-row {
  display: grid;
  min-height: 4.6rem;
  align-items: center;
  padding: 0.85rem 1rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(9rem, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--surface);
  column-gap: 1rem;
}

.admin-row__identity,
.admin-row__meta {
  min-width: 0;
}

.admin-row__identity strong,
.admin-row__identity span,
.admin-row__meta span,
.admin-row__meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row__identity strong {
  font-size: 0.88rem;
  font-weight: 600;
}

.admin-row__identity span,
.admin-row__meta span {
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.admin-row__meta small {
  margin-top: 0.3rem;
  color: var(--ink-faint);
  font-size: 0.7rem;
}

.admin-row__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.admin-row__actions button {
  min-height: 2.2rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.42rem;
  background: #fff;
  color: #414a46;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
}

.admin-row__actions button:hover {
  border-color: var(--green-line);
  color: var(--green);
}

.admin-row__actions button[data-tone="danger"] {
  border-color: #ddc1bd;
  color: #8b3f35;
}

.admin-empty {
  padding: 3rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: 0.55rem;
  color: var(--ink-soft);
  text-align: center;
}

.admin-empty h2 {
  margin: 0;
  color: #4d5551;
  font-size: 0.95rem;
  font-weight: 600;
}

.admin-empty p {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  line-height: 1.6;
}

.identity-dialog {
  width: min(calc(100% - 2rem), 31rem);
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 0.7rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1.5rem 5rem rgb(32 42 38 / 18%);
}

.identity-dialog--wide {
  width: min(calc(100% - 2rem), 39rem);
}

.identity-dialog::backdrop {
  background: rgb(32 42 38 / 30%);
}

.identity-dialog .dialog-form {
  padding: 1.6rem;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.dialog-heading p {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.65;
}

.dialog-heading--split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-close-button {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f3f4f3;
  color: #58615d;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.permission-selector {
  display: grid;
  max-height: 18rem;
  padding: 0.9rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  gap: 0.85rem;
}

.permission-group {
  display: grid;
  margin: 0;
  padding: 0;
  border: 0;
  gap: 0.45rem;
}

.permission-group legend {
  margin-bottom: 0.35rem;
  padding: 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 600;
}

.permission-option {
  display: flex;
  min-height: 2.7rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: 0.42rem;
  background: #f8f9f8;
  cursor: pointer;
  gap: 0.7rem;
}

.permission-option:hover {
  background: #f2f5f3;
}

.permission-option input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--green);
}

.permission-option__copy {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.permission-option__copy strong {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-option__copy small {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.account-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.one-time-secret {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}

.one-time-secret code {
  display: flex;
  min-width: 0;
  min-height: 2.75rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  background: #f7f8f7;
  color: #25322d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .identity-public-header {
    min-height: 5rem;
    padding: 1.5rem 1.25rem;
  }

  .identity-brand img {
    width: 6.85rem;
  }

  .identity-public-main {
    min-height: calc(100vh - 5rem);
    padding-top: 1.5rem;
  }

  .identity-auth-panel {
    padding: 1.5rem 1.35rem 1.65rem;
  }

  .identity-auth-heading h1,
  .identity-page-heading h1 {
    font-size: 1.75rem;
  }

  .identity-main {
    min-height: calc(100vh - 7.6rem);
    padding-bottom: 3rem;
  }

  .impersonation-banner {
    position: sticky;
    z-index: 18;
    top: 4.2rem;
    padding-inline: 1rem;
  }

  .impersonation-banner:not([hidden]) + .category-tabs {
    top: 7.2rem;
  }

  .settings-stack,
  .admin-tabs,
  .admin-page-feedback,
  .admin-loading,
  .admin-panel,
  .identity-page-heading--with-action {
    width: 100%;
  }

  .settings-stack {
    margin-top: 1.5rem;
  }

  .settings-panel__heading--actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-actions {
    justify-content: flex-start;
  }

  .admin-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-row__meta {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 0.45rem;
  }
}

@media (max-width: 560px) {
  .identity-mobile-account-copy {
    display: none;
  }

  .identity-page-heading--with-action {
    align-items: flex-start;
  }

  .settings-panel {
    padding-inline: 1.1rem;
  }

  .admin-tabs {
    justify-content: space-between;
    gap: 0.75rem;
  }

  .admin-tabs button {
    flex: 1;
  }

  .admin-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
    row-gap: 0.75rem;
  }

  .admin-row__meta {
    grid-column: auto;
    grid-row: auto;
    margin-top: 0;
  }

  .admin-row__actions {
    justify-content: flex-start;
  }

  .identity-dialog .dialog-form {
    padding: 1.3rem;
  }

  .dialog-actions,
  .account-dialog-actions {
    grid-template-columns: 1fr;
  }

  .account-dialog-actions {
    display: grid;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .one-time-secret {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 370px) {
  .account-button > .identity-avatar {
    display: inline-flex;
  }

  .identity-auth-panel {
    padding-inline: 1.1rem;
  }
}
