.auth-page {
  position: relative;
  min-height: 100dvh;
  background: var(--agent-sunken);
  color: var(--agent-text);
}

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(18rem, 26rem) minmax(28rem, 34rem);
  align-items: center;
  justify-content: center;
  gap: clamp(3rem, 7vw, 7rem);
  padding: clamp(1.25rem, 4vw, 3rem);
}

.auth-brand-panel {
  width: 100%;
  color: var(--agent-text);
}

.auth-brand {
  display: grid;
  gap: 1.5rem;
}

.auth-brand__product {
  display: block;
  width: min(15rem, 100%);
  height: auto;
}

.auth-brand__organization {
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--agent-line);
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--agent-surface) 78%, transparent);
  color: var(--agent-muted);
  font-size: var(--text-ui-sm);
}

.auth-brand__logo {
  display: block;
  max-width: 8rem;
  max-height: 2.5rem;
  object-fit: contain;
}

.auth-brand-panel__copy {
  margin-top: clamp(3rem, 8vh, 6rem);
}

.auth-brand-panel__eyebrow {
  margin: 0 0 0.75rem;
  color: var(--agent-blue);
  font-size: var(--text-panel-label);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-brand-panel__copy h2 {
  max-width: 24rem;
  margin: 0;
  color: var(--agent-text);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.05em;
}

.auth-brand-panel__copy > p:last-child {
  max-width: 23rem;
  margin: 1.2rem 0 0;
  color: var(--agent-muted);
  font-size: var(--text-ui-md);
  line-height: 1.65;
}

.auth-brand-panel__trust {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--agent-muted);
  font-size: var(--text-ui-sm);
}

.auth-brand-panel__trust > span:first-child {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--agent-green);
  color: var(--agent-green-text);
  font-weight: 700;
}

.auth-shell__content {
  width: 100%;
}

.auth-shell--simple {
  grid-template-columns: minmax(0, 30rem);
  align-content: center;
}

.auth-simple-panel {
  display: grid;
  gap: 2rem;
}

.auth-shell--simple .auth-brand {
  justify-items: center;
}

.auth-shell--simple .auth-brand__product {
  width: min(12rem, 100%);
}

.auth-shell--simple .auth-brand__organization {
  width: min(100%, 28rem);
}

.auth-card {
  width: 100%;
  max-width: 34rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--agent-line);
  border-radius: 1rem;
  background: var(--agent-surface);
  box-shadow: 0 22px 64px color-mix(in srgb, var(--agent-text) 10%, transparent);
}

.auth-shell--simple .auth-card {
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-shell--simple .auth-card__header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-shell--simple .auth-card__header h1 {
  font-size: 1.55rem;
  letter-spacing: -0.035em;
}

.auth-shell--simple .auth-card__header > p:not(.auth-card__eyebrow) {
  margin-top: 0.35rem;
  color: var(--agent-muted);
  font-size: 0.925rem;
  line-height: 1.4;
}

.auth-shell--simple .auth-form {
  gap: 0.65rem;
}

.auth-shell--simple .auth-field {
  gap: 0;
}

.auth-shell--simple .auth-field input,
.auth-shell--simple .auth-input {
  min-height: 2.625rem;
  padding: 0.55rem 0.75rem;
  border-color: var(--agent-line-strong);
  border-radius: 0.45rem;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--agent-text) 4%, transparent);
}

.auth-shell--simple .auth-submit,
.auth-shell--simple .auth-button {
  min-height: 2.625rem;
  padding: 0.55rem 1rem;
  border-radius: 0.45rem;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

.auth-shell--simple .auth-text-link {
  display: block;
  margin-top: 1rem;
  color: var(--agent-muted);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
}

.auth-card__header {
  margin-bottom: 1.5rem;
}

.auth-card__header h1 {
  margin: 0;
  color: var(--agent-text);
  font-size: clamp(1.45rem, 5vw, 1.8rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.auth-card__header > p:not(.auth-card__eyebrow) {
  margin: 0.65rem 0 0;
  color: var(--agent-muted);
  font-size: var(--text-ui-base);
  line-height: 1.55;
}

.auth-card__eyebrow {
  margin: 0 0 0.45rem;
  color: var(--agent-blue);
  font-size: var(--text-panel-label);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card__notice,
.auth-notice,
.auth-error {
  margin: 0 0 1rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--agent-line);
  border-radius: 0.65rem;
  background: var(--agent-soft);
  color: var(--agent-body);
  font-size: var(--text-ui-sm);
  line-height: 1.5;
}

.auth-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.auth-field label {
  color: var(--agent-body);
  font-size: var(--text-ui-sm);
  font-weight: 600;
}

.auth-field input,
.auth-field select,
.auth-field textarea,
.auth-input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--agent-line-strong);
  border-radius: 0.65rem;
  background: var(--agent-surface);
  color: var(--agent-text);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.auth-field input::placeholder,
.auth-field textarea::placeholder,
.auth-input::placeholder {
  color: var(--agent-faint);
}

.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus,
.auth-input:focus {
  border-color: var(--agent-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--agent-blue) 16%, transparent);
}

.auth-field .field_with_errors {
  display: contents;
}

.auth-field .field_with_errors input {
  border-color: var(--destructive);
}

.auth-submit,
.auth-button {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 0.65rem;
  background: var(--agent-action);
  color: var(--agent-surface);
  font-weight: 650;
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease;
}

.auth-submit:hover,
.auth-button:hover {
  filter: brightness(0.94);
}

.auth-submit:active,
.auth-button:active {
  transform: translateY(1px);
}

.auth-submit:focus-visible,
.auth-button:focus-visible,
.auth-link-button:focus-visible,
.auth-text-link:focus-visible,
.auth-choice-list__item:focus-visible {
  outline: 2px solid var(--agent-blue);
  outline-offset: 2px;
}

.auth-text-link,
.auth-link-button {
  color: var(--agent-blue);
  font-size: var(--text-ui-sm);
  font-weight: 600;
}

.auth-text-link {
  display: inline-block;
  margin-top: 1rem;
}

.auth-text-link:hover,
.auth-link-button:hover {
  text-decoration: underline;
}

.auth-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.auth-card > form:has(.auth-link-button) {
  margin-top: 1.25rem;
}

.auth-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--agent-line-soft);
}

.auth-card__actions .auth-text-link {
  margin-top: 0;
}

.auth-card__actions form {
  margin: 0;
}

.auth-choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-choice-list__form {
  margin: 0;
}

.auth-choice-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--agent-line);
  border-radius: 0.7rem;
  background: var(--agent-card);
  color: var(--agent-body);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-ui-base);
  font-weight: 600;
  text-align: left;
}

.auth-choice-list__item:hover {
  border-color: var(--agent-line-strong);
  background: var(--agent-hover);
  color: var(--agent-text);
}

/* Global account settings deliberately sit outside a tenant shell. Keep them
   compact and recognizable without implying that an organization is active. */
.account-page {
  min-height: 100dvh;
  background: var(--agent-bg);
  color: var(--agent-text);
}

.account-topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  height: var(--chrome-h);
  border-bottom: 1px solid var(--agent-line);
  background: var(--agent-surface);
}

.account-topbar__inner {
  width: min(calc(100% - 2rem), 64rem);
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.account-topbar__brand {
  color: var(--agent-text);
  font-size: var(--text-ui-base);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.account-topbar__return {
  color: var(--agent-blue);
  font-size: var(--text-ui-sm);
  font-weight: 650;
}

.account-topbar__return:hover {
  text-decoration: underline;
}

.account-layout {
  width: min(calc(100% - 2rem), 64rem);
  margin: 0 auto;
  padding: 2rem 0 4rem;
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  align-items: start;
  gap: 2rem;
}

.account-sidebar {
  position: sticky;
  top: calc(var(--chrome-h) + 2rem);
}

.account-sidebar__label {
  margin: 0 0 0.55rem;
  color: var(--agent-muted);
  font-size: var(--text-panel-label);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.account-sidebar__link {
  padding: 0.55rem 0.7rem;
  border-radius: 0.55rem;
  color: var(--agent-body);
  font-size: var(--text-ui-base);
  font-weight: 550;
}

.account-sidebar__link:hover {
  background: var(--agent-hover);
  color: var(--agent-text);
}

.account-sidebar__link.is-active {
  background: var(--agent-soft);
  color: var(--agent-blue);
  font-weight: 650;
}

.account-content {
  min-width: 0;
}

.account-panel {
  overflow: hidden;
  border: 1px solid var(--agent-line);
  border-radius: 0.9rem;
  background: var(--agent-surface);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--agent-text) 5%, transparent);
}

.account-panel__header,
.account-panel__section {
  padding: 1.5rem;
}

.account-panel__header {
  border-bottom: 1px solid var(--agent-line-soft);
}

.account-panel__header h1 {
  margin: 0;
  color: var(--agent-text);
  font-size: clamp(1.45rem, 3vw, 1.8rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.account-panel__header p,
.account-panel__section > p,
.account-recovery-codes > p {
  margin: 0.45rem 0 0;
  color: var(--agent-muted);
  font-size: var(--text-ui-base);
}

.account-panel__section + .account-panel__section {
  border-top: 1px solid var(--agent-line-soft);
}

.account-panel__section h2,
.account-recovery-codes h2 {
  margin: 0;
  color: var(--agent-text);
  font-size: 1rem;
  line-height: 1.35;
}

.account-panel__section .auth-form {
  max-width: 30rem;
  margin-top: 1.15rem;
}

.account-submit {
  align-self: flex-start;
  width: auto;
  min-width: 10rem;
}

.account-submit--secondary {
  border: 1px solid var(--agent-line-strong);
  background: var(--agent-surface);
  color: var(--agent-body);
}

.account-recovery-codes {
  margin: 1.5rem;
  padding: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--agent-blue) 30%, var(--agent-line));
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--agent-blue) 5%, var(--agent-surface));
}

.recovery-code-list {
  margin: 1rem 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  list-style: none;
}

.recovery-code-list code {
  display: block;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--agent-line);
  border-radius: 0.45rem;
  background: var(--agent-surface);
  color: var(--agent-body);
  font-size: var(--text-ui-sm);
  text-align: center;
}

.account-recovery-codes__continue {
  display: inline-flex;
  width: auto;
  align-items: center;
  justify-content: center;
}

.recovery-codes-dialog {
  position: fixed;
  z-index: 100;
  inset: 0;
  padding: 1rem;
  display: grid;
  place-items: center;
}

.recovery-codes-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--agent-text) 45%, transparent);
  backdrop-filter: blur(2px);
}

.recovery-codes-dialog__card {
  position: relative;
  width: min(100%, 32rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--agent-line);
  border-radius: 1rem;
  background: var(--agent-surface);
  box-shadow: 0 24px 64px color-mix(in srgb, var(--agent-text) 24%, transparent);
}

.recovery-codes-dialog__card h2 {
  margin: 0;
  color: var(--agent-text);
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.recovery-codes-dialog__card > p:not(.auth-card__eyebrow) {
  margin: 0.6rem 0 0;
  color: var(--agent-muted);
  font-size: var(--text-ui-base);
}

.recovery-codes-dialog__card .recovery-code-list {
  margin: 1.25rem 0;
}

.recovery-codes-dialog__card .auth-button {
  margin-top: 1rem;
}

.recovery-codes-dialog__note {
  font-size: var(--text-ui-sm) !important;
}

@media (max-width: 56rem) {
  .auth-shell {
    grid-template-columns: minmax(0, 34rem);
    align-content: center;
    gap: 1.5rem;
  }

  .auth-brand-panel__copy,
  .auth-brand-panel__trust {
    display: none;
  }

  .auth-brand__organization {
    margin-top: -0.5rem;
  }
}

@media (max-width: 32rem) {
  .auth-shell {
    align-content: start;
  }

  .auth-card {
    padding: 1.25rem;
    border-radius: 0.85rem;
  }

  .auth-card__actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-topbar__inner,
  .account-layout {
    width: min(calc(100% - 1.25rem), 64rem);
  }

  .account-layout {
    padding-top: 1rem;
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .account-sidebar {
    position: static;
  }

  .account-sidebar__nav {
    flex-direction: row;
  }

  .account-sidebar__link {
    flex: 1;
    text-align: center;
  }

  .account-panel__header,
  .account-panel__section {
    padding: 1.2rem;
  }

  .account-recovery-codes {
    margin: 1.2rem;
  }

  .recovery-code-list {
    grid-template-columns: 1fr;
  }

  .account-submit,
  .account-recovery-codes__continue {
    width: 100%;
  }
}
