:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-blue: #fff0eb;
  --line: #ead7cf;
  --line-strong: #cfa99d;
  --text: #333333;
  --muted: #655a55;
  --faint: #8a766d;
  --blue: #d95f3f;
  --blue-strong: #983923;
  --green: #16794a;
  --green-soft: #e7f7ed;
  --orange: #a85b12;
  --red: #b42318;
  --red-soft: #fff1f0;
  --yellow: #ffd43d;
  --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);
}

[class^="mgc_"]::before,
[class*=" mgc_"]::before {
  color: currentColor;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  cursor: pointer;
}

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

p,
h1,
h2,
h3,
dl,
dd {
  margin: 0;
}

.signup-shell {
  min-height: 100vh;
  padding: 20px 28px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1440px;
  min-height: 72px;
  margin: 0 auto 26px;
}

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

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

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #ffffff;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 5px;
  font-size: 17px;
  font-weight: 800;
}

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

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

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

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.login-link,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-chip {
  color: var(--blue-strong);
  background: var(--surface-blue);
}

.login-link {
  color: var(--muted);
  border: 1px solid var(--line);
  text-decoration: none;
}

.login-link:hover {
  color: var(--blue-strong);
  border-color: var(--line-strong);
}

.signup-layout {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 780px);
  gap: 48px;
  max-width: 1160px;
  margin: 0 auto;
}

.invitation-confirm-layout {
  grid-template-columns: minmax(240px, 300px) minmax(0, 860px);
  max-width: 1200px;
}

.flow-panel {
  align-self: start;
  padding: 2px 22px 0 0;
  border-right: 1px solid var(--line);
}

.flow-intro {
  padding: 4px 4px 18px;
}

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

.flow-intro h1 {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.24;
}

.flow-intro p:not(.eyebrow) {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.step-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.step-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 8px 10px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  transition:
    background 180ms ease,
    color 180ms ease;
}

.step-button:hover {
  color: var(--blue-strong);
  background: rgba(238, 247, 252, 0.7);
}

.step-button.is-active {
  color: var(--text);
  background: var(--surface-blue);
}

.step-button.is-done .step-index {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.step-button.is-locked {
  cursor: not-allowed;
  opacity: 0.55;
}

.step-index {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--blue);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.step-button strong,
.step-button small {
  display: block;
}

.step-button strong {
  font-size: 14px;
}

.step-button small {
  margin-top: 3px;
  color: currentColor;
  font-size: 12px;
  line-height: 1.45;
  opacity: 0.75;
}

.work-panel {
  min-height: 640px;
  padding: 2px 0 0;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin-top: 6px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.18;
}

.step-view {
  display: none;
  padding-top: 28px;
}

.step-view.is-active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

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

.field input,
.field select {
  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:hover,
.field select:hover {
  border-color: var(--blue);
}

.field input:focus,
.field select:focus {
  border-color: var(--blue);
}

.field input[aria-invalid="true"] {
  background: var(--red-soft);
  border-color: var(--red);
}

.field-help,
.field-error {
  min-height: 17px;
  font-size: 12px;
  line-height: 1.45;
}

.field-help {
  color: var(--faint);
}

.field-error {
  color: var(--red);
  font-weight: 700;
}

.suffix-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  background: #ffffff;
  border-bottom: 1px solid var(--line-strong);
}

.suffix-input:focus-within {
  border-color: var(--blue);
  box-shadow: var(--ring);
}

.suffix-input input {
  border: 0;
  box-shadow: none;
}

.suffix-input > span {
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.notice,
.tenant-rule,
.mail-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 24px;
  padding-left: 14px;
  border-left: 3px solid #e5a08d;
}

.mail-card {
  margin-top: 0;
}

.notice > span,
.mail-card > span,
.rule-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--blue);
  font-size: 20px;
}

.notice p,
.tenant-rule p,
.mail-card p,
.done-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.mail-card h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.invite-badge {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 8px 0 22px;
  padding: 18px;
  color: var(--blue-strong);
  background: var(--surface-blue);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invite-badge > span {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--blue);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 22px;
}

.invite-badge h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
}

.invite-badge p {
  color: var(--muted);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.checkbox-error {
  display: block;
  margin-top: 6px;
}

.code-field {
  max-width: 260px;
  margin-top: 20px;
}

.code-field input {
  height: 58px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.availability-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.availability-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: #f4f7fa;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.availability-status.is-available {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b9dfc8;
}

.availability-status.is-unavailable {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f2b8b5;
}

.availability-status.is-checking {
  color: var(--blue-strong);
  background: var(--surface-blue);
  border-color: #e5a08d;
}

.ghost-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 8px;
  font-weight: 800;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.small-button {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: 12px;
}

.ghost-button,
.secondary-button {
  color: var(--blue);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.ghost-button:hover,
.secondary-button:hover {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

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

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

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.tenant-rule {
  border-color: #e4b86f;
}

.tenant-rule .rule-icon {
  color: var(--orange);
}

.owner-summary,
.next-grid,
.result-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.owner-summary article,
.next-card,
.result-list div {
  min-width: 0;
  padding: 16px 18px 16px 0;
}

.owner-summary article + article,
.next-card + .next-card,
.result-list div + div {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.owner-summary article > span,
.next-card > span {
  display: grid;
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  place-items: center;
  color: var(--blue);
  font-size: 19px;
}

.owner-summary p,
.next-card small,
.result-list dt {
  color: var(--muted);
  font-size: 12px;
}

.owner-summary strong,
.next-card strong,
.result-list dd {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.done-panel {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 28px 0;
  text-align: center;
}

.done-panel > span {
  display: grid;
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 8px;
  font-size: 32px;
}

.done-panel h3 {
  margin-bottom: 8px;
  font-size: 24px;
}

.result-list {
  margin-bottom: 20px;
}

.next-grid {
  margin-top: 16px;
  margin-bottom: 0;
}

.next-card {
  color: inherit;
  text-decoration: none;
  transition:
    color 180ms ease,
    background 180ms ease;
}

.next-card:hover {
  color: var(--blue-strong);
  background: rgba(238, 247, 252, 0.5);
}

.form-alert {
  min-height: 20px;
  margin-top: 18px;
  color: var(--blue-strong);
  font-size: 13px;
  font-weight: 800;
}

.form-alert.is-error {
  color: var(--red);
}

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

.form-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1180px) {
  .signup-layout {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 34px;
  }
}

@media (max-width: 820px) {
  .signup-shell {
    padding: 12px;
  }

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

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

  .signup-layout {
    grid-template-columns: 1fr;
  }

  .flow-panel {
    padding: 0;
    border-right: 0;
  }

  .work-panel {
    min-height: auto;
    padding: 12px 0 0;
  }

  .panel-heading,
  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .owner-summary,
  .next-grid,
  .result-list {
    grid-template-columns: 1fr;
  }

  .owner-summary article + article,
  .next-card + .next-card,
  .result-list div + div {
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 520px) {
  .brand-note {
    display: none;
  }

  .login-link {
    max-width: 100%;
    white-space: normal;
  }

  .suffix-input {
    grid-template-columns: 1fr;
  }

  .suffix-input > span {
    padding: 0 12px 10px;
  }
}
