* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--surface-canvas);
  color: var(--text-body);
  font-family: var(--font-ui);
  font-size: var(--type-body);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a,
input {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.auth-layout {
  display: grid;
  min-height: 100vh;
  grid-template-rows: 64px minmax(0, 1fr);
}

.auth-brand-panel {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-rail);
  color: var(--text-body);
}

.brand {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand strong {
  font-family: var(--font-headline);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.brand small,
.brand-footnote {
  margin-top: 5px;
  color: var(--text-muted);
  font-family: var(--font-machine);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
}

.brand-mark-shell {
  fill: var(--text-primary);
}

.brand-mark-glyph {
  fill: var(--surface-rail);
}

.eyebrow {
  display: block;
  margin: 0 0 8px;
  color: var(--text-muted);
  font-family: var(--font-machine);
  font-size: var(--type-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-footnote {
  margin: 0;
}

.auth-workspace {
  display: flex;
  min-height: calc(100vh - 64px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 42px 24px;
}

.theme-switch {
  display: flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-card);
}

.theme-switch button {
  min-height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-machine);
  font-size: var(--type-label);
}

.theme-switch button.active {
  background: var(--ink);
  color: var(--on-ink);
}

.auth-card,
.preview-identities {
  width: min(480px, 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-card);
}

.auth-card {
  min-height: 390px;
  padding: clamp(28px, 5vw, 46px);
}

.auth-step h2,
.preview-identities h2 {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.step-description {
  margin: 10px 0 26px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.step-description strong {
  color: var(--text-primary);
  font-weight: 500;
}

.session-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 10px;
  margin: 10px 0 8px;
  color: var(--text-secondary);
  font-size: var(--type-secondary);
}

.session-identity strong {
  color: var(--text-primary);
  font-weight: 500;
}

.session-identity .text-button {
  margin: 0 0 0 auto;
  font-size: var(--type-secondary);
}

form label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-primary);
  font-family: var(--font-button);
  font-size: var(--type-control);
  font-weight: 500;
}

input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: 0;
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 16px;
}

input:focus {
  border-color: var(--ink);
}

input.invalid {
  border-color: var(--warning);
}

.field-hint,
.method-note,
.resend-status {
  min-height: 34px;
  margin: 8px 0 14px;
  color: var(--text-muted);
  font-size: var(--type-secondary);
  line-height: 1.45;
}

.field-hint.is-employee {
  color: var(--success);
}

.field-hint.is-error {
  color: var(--warning);
}

.primary-button,
.google-button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--on-ink);
  cursor: pointer;
  font-family: var(--font-button);
  font-size: var(--type-control);
  font-weight: 500;
}

.google-button span {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  background: var(--on-ink);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 500;
}

.back-button,
.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--type-secondary);
}

.back-button {
  display: block;
  margin-bottom: 34px;
}

.text-button {
  margin-top: 14px;
  color: var(--text-primary);
  font-family: var(--font-button);
  font-weight: 500;
}

.auth-method-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 20px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-headline);
  font-size: 18px;
}

.method-note {
  margin-top: 13px;
  text-align: center;
}

.code-input {
  font-family: var(--font-machine);
  font-size: 22px;
  letter-spacing: 0.32em;
  text-align: center;
}

.mock-code {
  min-height: 0;
  font-family: var(--font-machine);
  text-align: center;
}

.mock-code strong {
  color: var(--text-primary);
  font-weight: 500;
  letter-spacing: 0.12em;
}

.organization-list {
  display: grid;
  max-height: min(440px, calc(100vh - 390px));
  padding-right: 3px;
  overflow-y: auto;
  gap: 8px;
}

.organization-search {
  margin-bottom: 12px;
}

.organization-search label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-primary);
  font-family: var(--font-button);
  font-size: var(--type-control);
  font-weight: 500;
}

.organization-search input {
  height: 42px;
  font-size: var(--type-control);
}

.organization-search-status {
  margin: -3px 0 12px;
  color: var(--text-muted);
  font-size: var(--type-secondary);
}

.organization-source-status {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--warning-surface);
  color: var(--warning);
  font-size: var(--type-secondary);
  line-height: 1.45;
}

.organization-option {
  display: grid;
  min-height: 60px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-card);
  color: var(--text-body);
  cursor: pointer;
  text-align: left;
}

.organization-option:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.organization-option strong,
.organization-option small {
  display: block;
}

.organization-option strong {
  color: var(--text-primary);
  font-size: var(--type-control);
  font-weight: 500;
}

.organization-option small {
  margin-top: 4px;
  color: var(--text-muted);
  font-family: var(--font-machine);
  font-size: var(--type-label);
  text-transform: uppercase;
}

.organization-option > span:last-child {
  color: var(--text-muted);
  font-family: var(--font-machine);
}

.preview-identities {
  overflow: hidden;
}

.preview-identities > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.preview-identities h2 {
  font-size: var(--type-heading-small);
}

.preview-identities > header > span {
  color: var(--text-muted);
  font-family: var(--font-machine);
  font-size: var(--type-label);
  text-transform: uppercase;
}

.identity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.identity-grid button {
  min-height: 66px;
  padding: 11px 15px;
  border: 0;
  border-right: 1px solid var(--row-border);
  border-bottom: 1px solid var(--row-border);
  background: transparent;
  color: var(--text-body);
  cursor: pointer;
  text-align: left;
}

.identity-grid button:nth-child(2n) {
  border-right: 0;
}

.identity-grid button:hover {
  background: var(--surface-hover);
}

.identity-grid strong,
.identity-grid span {
  display: block;
}

.identity-grid strong {
  color: var(--text-primary);
  font-size: var(--type-secondary);
  font-weight: 500;
}

.identity-grid span {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: var(--type-meta);
}

.admin-preview-link {
  display: block;
  padding: 12px 15px;
  color: var(--text-secondary);
  font-size: var(--type-secondary);
  text-decoration: none;
}

.admin-preview-link:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

@media (max-width: 820px) {
  .auth-brand-panel {
    padding: 0 18px;
  }

  .brand-footnote {
    display: none;
  }

  .auth-workspace {
    min-height: calc(100vh - 64px);
    justify-content: flex-start;
    padding: 32px 18px;
  }
}

@media (max-width: 520px) {
  .auth-card {
    min-height: 360px;
    padding: 28px 22px;
  }

  .identity-grid {
    grid-template-columns: 1fr;
  }

  .identity-grid button {
    border-right: 0;
  }
}
