:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #fff0eb;
  --line: #ead7cf;
  --line-strong: #cfa99d;
  --text: #333333;
  --muted: #655a55;
  --primary: #d95f3f;
  --primary-strong: #983923;
  --red: #b42318;
  --ring: 0 0 0 3px rgba(217, 95, 63, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

p,
h1 {
  margin: 0;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 460px);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 154px;
  height: auto;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  border-radius: 5px;
  font-weight: 800;
}

.brand-name,
.brand-note {
  display: block;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
}

.brand-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 28px;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 800;
}

.mode-tab.is-active {
  color: var(--primary-strong);
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.login-form {
  display: none;
  margin-top: 26px;
}

.login-form.is-active {
  display: grid;
  gap: 16px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1 {
  margin-top: 6px;
  font-size: 26px;
  line-height: 1.2;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field small {
  color: var(--muted);
  font-size: 12px;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
}

.field input:focus {
  border-color: var(--primary);
}

.code-field input {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-align: center;
}

.mail-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.mail-notice span[aria-hidden="true"] {
  color: var(--primary);
  font-size: 20px;
  line-height: 1.3;
}

.mail-notice p {
  margin: 0;
}

.mail-notice #emailOtpDestination {
  color: var(--text);
  font-weight: 800;
}

.tenant-selection-account {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.tenant-selection-account > span {
  color: var(--primary);
  font-size: 22px;
}

.tenant-selection-account #tenantSelectionEmail {
  color: var(--text);
  font-weight: 800;
}

.tenant-selection-list {
  display: grid;
  gap: 10px;
}

.tenant-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 92px;
  padding: 12px;
  color: var(--muted);
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.tenant-option:hover,
.tenant-option:focus-visible {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.tenant-option-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--primary);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 20px;
}

.tenant-option-body,
.tenant-option-body strong,
.tenant-option-body small,
.tenant-option-meta {
  display: block;
}

.tenant-option-body strong {
  color: var(--text);
  font-size: 15px;
}

.tenant-option-body small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tenant-option-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.tenant-option-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.tenant-option-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--primary-strong);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.empty-tenant-selection {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.empty-tenant-selection > span {
  color: var(--red);
  font-size: 28px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  color: #ffffff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

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

.secondary-button:hover,
.secondary-button:focus-visible {
  background: #fff8f5;
}

.text-button {
  padding: 0;
  color: var(--primary-strong);
  background: transparent;
  border: 0;
}

.text-button:hover,
.text-button:focus-visible {
  text-decoration: underline;
}

.form-link-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -8px;
}

.form-back-button {
  justify-self: center;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.form-alert {
  min-height: 20px;
  margin-top: 16px;
  color: var(--red);
  font-weight: 700;
}

.login-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.login-footer a {
  color: var(--primary-strong);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 520px) {
  .tenant-option {
    grid-template-columns: 1fr;
  }

  .tenant-option-action {
    width: 100%;
  }
}
