/* Hallmark · component-scope redesign inside the Volant system · tone: utilitarian, calm
 * shape: the ElevateIQ sign-in (logo top-left, dotted field, compact card) in Volant tokens
 * states: default · hover · focus · active · disabled · loading · error · success
 * Hallmark · pre-emit critique: P4 H4 E4 S5 R5 V4
 *
 * Feature CSS for ENG-6426 (Volant identity). Prefix: idn-.
 * Shared components (Button, Input, Field, Dialog, DropdownMenu*, Select*, Skeleton,
 * Spinner, Checkbox) are imitated here so the page looks right. The component in
 * apps/web/src/components/ui is the spec.
 *
 * Markup:
 *   <body class="idn-page">
 *     <header class="idn-page__head"><img class="idn-page__logo"></header>
 *     <main class="idn-page__main">
 *       <section class="idn-card">
 *         <div class="idn-card__head"><h1 class="idn-card__title">…</h1><p class="idn-card__lede">…</p></div>
 *         <form class="idn-form">… .idn-field …</form>
 *         <p class="idn-card__foot">…</p>
 *       </section>
 *       <p class="idn-page__note">…</p>
 *     </main>
 *   </body>
 */

/* ---------- Page shell (login, code, forgot, reset, signup, no-access) ---------- */

html,
body {
  overflow-x: clip;
}

.idn-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg-subtle);
  /* The ElevateIQ dotted field, drawn with a token colour. */
  background-image: radial-gradient(var(--color-border-default) 1px, transparent 1px);
  background-size: 16px 16px;
}

.idn-page__head {
  padding: var(--space-24) clamp(16px, 7vw, 100px);
}

.idn-page__logo {
  display: block;
  /* The "powered by rePrecinct" line needs this width to be read (login.module.css). */
  width: 112px;
  height: auto;
}

.idn-page__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-16);
  padding: var(--space-16) var(--space-16) 64px;
}

.idn-page__note {
  max-width: 400px;
  margin: 0;
  color: var(--color-fg-muted);
  text-align: center;
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line-height);
}

/* ---------- Card ---------- */

.idn-card {
  width: min(400px, 100%);
  padding: var(--space-24);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface-default);
  box-shadow: var(--shadow-sm);
}

.idn-card--wide {
  width: min(480px, 100%);
}

.idn-card__head {
  margin-bottom: var(--space-20);
  padding-bottom: var(--space-16);
  border-bottom: 1px solid var(--color-border-subtle);
}

.idn-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-12);
  border-radius: var(--radius-full);
  background: var(--color-action-primary-subtle);
  color: var(--color-action-primary);
}

.idn-card__icon .ic {
  width: 20px;
  height: 20px;
}

.idn-card__icon--error {
  background: var(--color-status-error-subtle);
  color: var(--color-status-error-fg);
}

.idn-card__title {
  margin: 0;
  color: var(--color-fg-default);
  font-size: var(--text-heading-3-size);
  font-weight: var(--text-heading-3-weight);
  line-height: var(--text-heading-3-line-height);
  letter-spacing: var(--text-heading-3-letter-spacing);
  overflow-wrap: anywhere;
}

.idn-card__lede {
  margin: var(--space-6) 0 0;
  color: var(--color-fg-muted);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-line-height);
}

.idn-card__lede strong {
  color: var(--color-fg-default);
  font-weight: var(--font-weight-semibold);
  overflow-wrap: anywhere;
}

.idn-card__foot {
  margin: var(--space-20) 0 0;
  color: var(--color-fg-muted);
  text-align: center;
  font-size: var(--text-body-md-size);
}

.idn-card__body > p {
  margin: 0 0 var(--space-12);
  color: var(--color-fg-default);
  line-height: var(--text-body-md-line-height);
}

/* ---------- Form ---------- */

.idn-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.idn-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-12);
}

@media (max-width: 480px) {
  .idn-form__row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.idn-form__aside {
  display: flex;
  justify-content: flex-end;
  margin-top: calc(var(--space-8) * -1);
}

.idn-form__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  margin-top: var(--space-4);
}

.idn-form__group-title {
  margin: var(--space-4) 0 calc(var(--space-4) * -1);
  color: var(--color-fg-muted);
  font-size: var(--text-label-md-size);
  font-weight: var(--text-label-md-weight);
}

/* Field (imitates components/ui/field.module.css) */
.idn-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  min-width: 0;
}

.idn-field__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-8);
  color: var(--color-fg-default);
  font-size: var(--text-label-lg-size);
  font-weight: var(--text-label-lg-weight);
  line-height: var(--text-label-lg-line-height);
}

.idn-field__optional {
  color: var(--color-fg-muted);
  font-weight: var(--font-weight-regular);
}

.idn-field__control {
  position: relative;
  display: flex;
  min-width: 0;
}

.idn-field__hint,
.idn-field__error {
  margin: 0;
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line-height);
}

.idn-field__hint {
  color: var(--color-fg-muted);
}

.idn-field__error {
  display: flex;
  gap: var(--space-6);
  color: var(--color-status-error-fg);
}

.idn-field__error .ic {
  margin-top: 2px;
}

/* Input (imitates components/ui/input.module.css) */
.idn-input {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 2.25rem;
  padding: var(--space-8) var(--space-12);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface-default);
  color: var(--color-fg-default);
  font-family: var(--font-family-sans);
  font-size: var(--text-body-md-size);
  transition: border-color 120ms ease;
}

.idn-input::placeholder {
  color: var(--color-fg-subtle);
}

.idn-input:hover:not(:disabled):not([readonly]),
.idn-input.is-hover {
  border-color: var(--color-action-primary);
}

.idn-input:focus {
  outline: none;
}

.idn-input:focus-visible,
.idn-input.is-focus {
  outline: var(--focus-ring-width) solid transparent;
  border-color: var(--color-action-primary);
  box-shadow: var(--shadow-focus-ring);
}

.idn-input[aria-invalid="true"] {
  border-color: var(--color-status-error);
}

.idn-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--color-bg-muted);
}

/* Read-only: the value is part of the account, not a disabled control.
 * Full contrast text on muted ground, with a lock. */
.idn-input[readonly] {
  padding-right: 36px;
  border-color: var(--color-border-default);
  background: var(--color-bg-muted);
  color: var(--color-fg-default);
  cursor: default;
}

.idn-field__lock {
  position: absolute;
  top: 50%;
  right: var(--space-12);
  color: var(--color-fg-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

/* Password: the eye toggle is a real button inside the field. */
.idn-input--password {
  padding-right: 40px;
}

.idn-reveal {
  position: absolute;
  top: 50%;
  right: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--color-fg-muted);
  transform: translateY(-50%);
}

.idn-reveal:hover {
  background: var(--color-bg-muted);
  color: var(--color-fg-default);
}

/* Phone: country select + number (the shared phone rule of Request Account). */
.idn-phone {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--space-8);
}

.idn-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.25rem;
  padding: 0 var(--space-8) 0 var(--space-12);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface-default);
  color: var(--color-fg-default);
  font-size: var(--text-body-md-size);
}

.idn-select .ic {
  color: var(--color-fg-muted);
}

/* Caps-lock hint: shows only while caps lock is on. */
.idn-capslock[hidden] {
  display: none;
}

.idn-capslock {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin: 0;
  color: var(--color-status-warning-fg);
  font-size: var(--text-body-sm-size);
}

/* ---------- Password policy checklist ---------- */

.idn-policy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4) var(--space-12);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line-height);
}

@media (max-width: 360px) {
  .idn-policy {
    grid-template-columns: minmax(0, 1fr);
  }
}

.idn-policy__rule {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  color: var(--color-fg-muted);
}

.idn-policy__rule::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-full);
}

.idn-policy__rule[data-state="met"] {
  color: var(--color-status-success-fg);
}

.idn-policy__rule[data-state="met"]::before {
  border-color: var(--color-status-success);
  background:
    var(--color-status-success)
    url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCAxNiAxNicgZmlsbD0nbm9uZScgc3Ryb2tlPSd3aGl0ZScgc3Ryb2tlLXdpZHRoPScyLjUnIHN0cm9rZS1saW5lY2FwPSdyb3VuZCcgc3Ryb2tlLWxpbmVqb2luPSdyb3VuZCc+PHBhdGggZD0nTTEzIDQuNSA2LjUgMTEgMyA3LjUnLz48L3N2Zz4=")
    center / 10px no-repeat;
}

.idn-policy__rule[data-state="missed"] {
  color: var(--color-status-error-fg);
}

.idn-policy__rule[data-state="missed"]::before {
  border-color: var(--color-status-error);
}

/* ---------- Six-cell code ---------- */
/* In code: ONE <input autocomplete="one-time-code" inputmode="numeric" maxlength="6">
 * drawn over six cells. Paste and SMS/email autofill fill all six at once. */

.idn-code {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-8);
}

.idn-code__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-default);
  color: var(--color-fg-default);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
}

.idn-code__cell[data-state="active"] {
  border-color: var(--color-action-primary);
  box-shadow: var(--shadow-focus-ring);
}

.idn-code__cell[data-state="active"]::after {
  content: "";
  width: 2px;
  height: 24px;
  background: var(--color-action-primary);
  animation: idn-caret 1s steps(1) infinite;
}

.idn-code[data-state="error"] .idn-code__cell {
  border-color: var(--color-status-error);
}

.idn-code[data-state="disabled"] .idn-code__cell {
  background: var(--color-bg-muted);
  color: var(--color-fg-muted);
}

@keyframes idn-caret {
  50% {
    opacity: 0;
  }
}

.idn-resend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
  margin: 0;
  color: var(--color-fg-muted);
  font-size: var(--text-body-md-size);
}

.idn-resend__timer {
  font-variant-numeric: tabular-nums;
}

/* ---------- Buttons (imitate components/ui/button.module.css) ---------- */

/* The base rule is the Button `default` and `outline` variant, as in button.module.css.
 * So .idn-button--outline has no rule of its own. Height 2.25rem is copied from the component. */
.idn-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  height: 2.25rem;
  padding: var(--space-6) var(--space-12);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  background: var(--color-surface-default);
  color: var(--color-fg-default);
  font-size: var(--text-label-lg-size);
  font-weight: var(--text-label-lg-weight);
  line-height: var(--text-label-lg-line-height);
  white-space: nowrap;
  text-decoration: none;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.idn-button:hover:not(:disabled),
.idn-button.is-hover {
  background: var(--color-bg-muted);
}

.idn-button:focus-visible,
.idn-button.is-focus {
  outline: var(--focus-ring-width) solid transparent;
  box-shadow: var(--shadow-focus-ring);
}

.idn-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.idn-button--block {
  width: 100%;
}

.idn-button--primary {
  border-color: var(--color-action-primary);
  background: var(--color-action-primary);
  color: var(--color-fg-on-emphasis);
}

.idn-button--primary:hover:not(:disabled),
.idn-button--primary.is-hover {
  border-color: var(--color-action-primary-hover);
  background: var(--color-action-primary-hover);
}

.idn-button--primary[data-state="loading"] {
  cursor: progress;
  opacity: 0.85;
}

.idn-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-fg-link);
  font-size: var(--text-body-md-size);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  white-space: nowrap;
}

.idn-link:hover {
  text-decoration: underline;
}

.idn-link:focus-visible {
  outline: none;
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-focus-ring);
}

.idn-link--sm {
  font-size: var(--text-body-sm-size);
}

.idn-link--muted {
  color: var(--color-fg-muted);
}

.idn-link[aria-disabled="true"] {
  color: var(--color-fg-disabled);
  pointer-events: none;
}

.idn-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
}

/* ---------- Alerts ---------- */

.idn-alert {
  display: flex;
  gap: var(--space-8);
  margin: 0 0 var(--space-16);
  padding: var(--space-10) var(--space-12);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
  color: var(--color-fg-default);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-line-height);
}

.idn-alert .ic {
  margin-top: 3px;
}

.idn-alert--error {
  border-color: var(--color-status-error-subtle);
  background: var(--color-status-error-bg);
  color: var(--color-status-error-fg);
}

.idn-alert--success {
  border-color: var(--color-status-success-subtle);
  background: var(--color-status-success-bg);
  color: var(--color-status-success-fg);
}

.idn-alert--info {
  border-color: var(--color-action-primary-subtle);
  background: var(--color-action-primary-bg);
  color: var(--color-fg-default);
}

.idn-alert--info .ic {
  color: var(--color-action-primary);
}

.idn-alert--warning {
  border-color: var(--color-status-warning-subtle);
  background: var(--color-status-warning-bg);
  color: var(--color-status-warning-fg);
}

.idn-alert__body {
  min-width: 0;
}

.idn-alert__body p {
  margin: 0;
}

/* Turnstile placeholder: third-party UI, drawn as a labelled box. */
.idn-turnstile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  height: 65px;
  padding: 0 var(--space-12);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-bg-subtle);
  color: var(--color-fg-muted);
  font-size: var(--text-body-sm-size);
}

.idn-turnstile__box {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  color: var(--color-fg-default);
}

.idn-turnstile__check {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-xs);
  background: var(--color-surface-default);
}

/* Choice blocks on the no-access page */
.idn-choice {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  margin: 0;
  padding: 0;
  list-style: none;
}

.idn-choice__item {
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
}

.idn-choice__title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-label-lg-size);
  font-weight: var(--text-label-lg-weight);
}

.idn-choice__text {
  margin: 0 0 var(--space-8);
  color: var(--color-fg-muted);
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line-height);
}

.idn-choice__text:last-child {
  margin-bottom: 0;
}

/* Spinner (imitates components/ui/spinner) */
.idn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

/* ---------- Share viewer backdrop + Tenant modal ---------- */

.idn-share {
  min-height: 100vh;
  background: var(--color-bg-subtle);
}

.idn-share__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  min-height: 72px;
  padding: 0 clamp(16px, 4vw, 40px);
  background: var(--color-action-primary);
  color: var(--color-fg-on-emphasis);
}

.idn-share__brand {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-width: 0;
}

.idn-share__logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
}

.idn-share__title {
  margin: 0;
  overflow: hidden;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idn-share__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  background: var(--color-bg-muted);
  color: var(--color-fg-default);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.idn-share__doc {
  max-width: 760px;
  margin: var(--space-24) auto;
  padding: 40px clamp(16px, 5vw, 56px);
  border-radius: var(--radius-md);
  background: var(--color-surface-default);
  box-shadow: var(--shadow-card);
}

.idn-share__doc--blurred {
  filter: blur(6px);
  user-select: none;
}

.idn-share__line {
  height: 10px;
  margin-bottom: var(--space-12);
  border-radius: var(--radius-full);
  background: var(--color-bg-muted);
}

.idn-share__line--title {
  width: 55%;
  height: 18px;
  margin-bottom: var(--space-24);
}

.idn-share__line--short {
  width: 70%;
}

/* Dialog (imitates components/ui/dialog.module.css) */
.idn-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog-overlay);
  background: color-mix(in srgb, var(--color-neutral-950) 45%, transparent);
}

.idn-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: var(--z-dialog);
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: var(--space-24);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface-default);
  box-shadow: var(--shadow-modal);
  transform: translate(-50%, -50%);
}

.idn-dialog--profile {
  width: min(480px, calc(100vw - 32px));
}

.idn-dialog__logo {
  display: block;
  width: 96px;
  height: auto;
  margin-bottom: var(--space-16);
}

.idn-dialog__close {
  position: absolute;
  top: var(--space-16);
  right: var(--space-16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-fg-muted);
}

.idn-dialog__close:hover {
  background: var(--color-bg-muted);
}

.idn-dialog__section {
  padding-top: var(--space-20);
  margin-top: var(--space-20);
  border-top: 1px solid var(--color-border-subtle);
}

.idn-dialog__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

.idn-dialog__section-title {
  margin: 0;
  font-size: var(--text-heading-4-size);
  font-weight: var(--text-heading-4-weight);
  line-height: var(--text-heading-4-line-height);
}

.idn-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8);
  margin-top: var(--space-20);
}

@media (max-width: 480px) {
  .idn-dialog {
    top: auto;
    bottom: 0;
    width: 100vw;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateX(-50%);
  }

  .idn-dialog__footer {
    flex-direction: column-reverse;
  }

  .idn-dialog__footer .idn-button {
    width: 100%;
  }
}

/* Read-only fact row (consent) */
.idn-fact {
  display: flex;
  gap: var(--space-8);
  padding: var(--space-10) var(--space-12);
  border-radius: var(--radius-md);
  background: var(--color-bg-muted);
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line-height);
}

.idn-fact .ic {
  margin-top: 2px;
  color: var(--color-fg-muted);
}

.idn-fact__label {
  margin: 0;
  font-weight: var(--font-weight-semibold);
}

.idn-fact__text {
  margin: 0;
  color: var(--color-fg-muted);
}

/* ---------- App shell + /profile ---------- */

.idn-app {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg-default);
}

.idn-sidebar {
  position: sticky;
  top: 0;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  width: 240px;
  height: 100vh;
  padding: var(--space-16) var(--space-12);
  border-right: 1px solid var(--color-border-default);
  background: var(--color-bg-subtle);
}

.idn-sidebar__logo {
  width: 88px;
  height: auto;
  margin: 0 var(--space-8);
}

.idn-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.idn-sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-8);
  border-radius: var(--radius-md);
  color: var(--color-fg-default);
  font-size: var(--text-body-md-size);
  text-decoration: none;
}

.idn-sidebar__user {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-10);
  width: 100%;
  padding: var(--space-8);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  text-align: left;
}

.idn-sidebar__user[aria-expanded="true"] {
  background: var(--color-bg-muted);
}

.idn-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  background: var(--color-bg-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.idn-identity {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.idn-identity__name {
  overflow: hidden;
  font-size: var(--text-body-md-size);
  font-weight: var(--font-weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idn-identity__email {
  overflow: hidden;
  color: var(--color-fg-muted);
  font-size: var(--text-body-sm-size);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* DropdownMenuContent */
.idn-menu {
  position: absolute;
  bottom: calc(100% + var(--space-8));
  left: 0;
  z-index: var(--z-popover);
  width: 248px;
  padding: var(--space-6);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface-overlay);
  box-shadow: var(--shadow-modal);
}

.idn-menu--top {
  top: calc(100% + var(--space-8));
  right: 0;
  bottom: auto;
  left: auto;
}

.idn-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  width: 100%;
  padding: var(--space-8) var(--space-10);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-fg-default);
  font-size: var(--text-body-md-size);
  text-align: left;
  text-decoration: none;
}

.idn-menu__item:hover,
.idn-menu__item[data-highlighted] {
  background: var(--color-bg-muted);
}

.idn-menu__item .ic {
  color: var(--color-fg-muted);
}

.idn-menu__sub {
  display: block;
  color: var(--color-fg-muted);
  font-size: var(--text-body-sm-size);
}

.idn-menu__separator {
  height: 1px;
  margin: var(--space-4) 0;
  background: var(--color-border-subtle);
}

/* NEW: the name-and-email header becomes a link to /profile (FR30). */
.idn-menu__profile {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-8) var(--space-10);
  border-radius: var(--radius-md);
  color: var(--color-fg-default);
  text-decoration: none;
}

.idn-menu__profile .idn-identity__name {
  font-size: var(--text-emphasis-lg-size);
  font-weight: var(--text-emphasis-lg-weight);
}

.idn-menu__profile > .ic {
  color: var(--color-fg-muted);
}

.idn-menu__profile:hover,
.idn-menu__profile[data-state="hover"],
.idn-menu__profile[data-highlighted] {
  background: var(--color-bg-muted);
}

.idn-menu__profile:hover > .ic,
.idn-menu__profile[data-state="hover"] > .ic {
  color: var(--color-fg-default);
}

/* Tenant menu: the identity header is not a link and not a menu item. */
.idn-menu__profile--static:hover {
  background: none;
}

.idn-menu__profile:focus-visible,
.idn-menu__profile[data-state="focus"] {
  outline: var(--focus-ring-width) solid transparent;
  box-shadow: var(--shadow-focus-ring);
}

.idn-main {
  flex: 1;
  min-width: 0;
  padding: 40px clamp(16px, 5vw, 64px) 80px;
}

.idn-profile {
  max-width: 640px;
}

.idn-profile__title {
  margin: 0;
  font-size: var(--text-heading-2-size);
  font-weight: var(--text-heading-2-weight);
  line-height: var(--text-heading-2-line-height);
  letter-spacing: var(--text-heading-2-letter-spacing);
}

.idn-profile__lede {
  margin: var(--space-6) 0 var(--space-24);
  color: var(--color-fg-muted);
}

.idn-section {
  margin-bottom: var(--space-24);
  padding: var(--space-24);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface-default);
}

.idn-section__head {
  margin-bottom: var(--space-20);
}

.idn-section__title {
  margin: 0;
  font-size: var(--text-heading-4-size);
  font-weight: var(--text-heading-4-weight);
  line-height: var(--text-heading-4-line-height);
}

.idn-section__lede {
  margin: var(--space-4) 0 0;
  color: var(--color-fg-muted);
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-line-height);
}

.idn-section__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-12);
  margin-top: var(--space-20);
  padding-top: var(--space-16);
  border-top: 1px solid var(--color-border-subtle);
}

/* Silent success next to the Save button. */
.idn-saved {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-status-success-fg);
  font-size: var(--text-body-sm-size);
}

.idn-skeleton {
  border-radius: var(--radius-sm);
  background: var(--color-bg-muted);
}

/* Phone width: the app shell shows a top bar; the sidebar opens as a sheet (unchanged code). */
.idn-topbar {
  display: none;
}

@media (max-width: 768px) {
  .idn-app {
    flex-direction: column;
  }

  .idn-sidebar {
    display: none;
  }

  .idn-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-12) var(--space-16);
    border-bottom: 1px solid var(--color-border-default);
    background: var(--color-bg-subtle);
  }

  .idn-main {
    padding-top: var(--space-24);
  }

  .idn-section {
    padding: var(--space-16);
  }

  .idn-section__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}

/* ---------- Visually hidden ---------- */
.idn-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .idn-code__cell[data-state="active"]::after,
  .idn-spinner {
    animation: none;
  }

  .idn-input,
  .idn-button {
    transition: none;
  }
}

/* Button variants used here (imitate button.module.css) */
.idn-button--secondary {
  border-color: var(--color-bg-muted);
  background: var(--color-bg-muted);
}

.idn-button--secondary:hover:not(:disabled) {
  border-color: var(--color-bg-muted-hover);
  background: var(--color-bg-muted-hover);
}

.idn-button--ghost {
  border-color: transparent;
  background: transparent;
}

.idn-button--outline-primary {
  border-color: var(--color-action-primary);
  color: var(--color-action-primary);
}

.idn-button--outline-primary:hover:not(:disabled) {
  border-color: var(--color-action-primary-hover);
  background: var(--color-action-primary-subtle);
  color: var(--color-action-primary-hover);
}
