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

body {
  background: var(--color-page-bg);
  color: #111827;
  font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
  font-size: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.login-page,
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.08fr) minmax(420px, 1fr);
  background: var(--color-page-bg);

  .brand {
    position: relative;
    overflow: hidden;
    background: var(--gradient-brand-primary);

    .inner {
      position: relative;
      z-index: 1;
      min-height: 100vh;
      padding: 40px 48px 48px;
      display: flex;
      flex-direction: column;

      .logo {
        margin: 0;
        color: var(--white);
        font-size: 24px;
        font-weight: 700;
        line-height: 24px;
        letter-spacing: 0.03em;
      }

      .copy {
        max-width: 544px;
        margin: auto 0;

        .eyebrow {
          margin: 0 0 14px;
          color: rgba(255, 255, 255, 0.6);
          font-size: 14px;
          font-weight: 700;
          line-height: 20px;
        }

        .title {
          margin: 0 0 22px;
          color: var(--white);
          font-size: 36px;
          font-weight: 700;
          line-height: 36px;
        }

        .text {
          margin: 0;
          color: rgba(255, 255, 255, 0.6);
          font-size: 14px;
          font-weight: 700;
          line-height: 22.5px;
        }
      }
    }

    &::before {
      content: "";
      position: absolute;
      inset: 0;
      background-image:
        linear-gradient(rgba(255, 255, 255, 0.2) 1.5px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1.5px, transparent 1px);
      background-size: 64px 64px;
      opacity: 0.3;
    }

  }

  .panel {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: linear-gradient(180deg, var(--slate-50) 0%, #eef3f8 100%);

    .card {
      width: min(100%, 384px);

      .card_header {
        margin-bottom: 24px;

        .card_brand {
          margin: 0 0 12px;
          color: var(--color-text-heading);
          font-size: 24px;
          font-weight: 700;
          line-height: 24px;
        }

        h1,
        h2 {
          margin: 0 0 8px;
          color: var(--color-text-heading);
          font-size: 24px;
          font-weight: 700;
          line-height: 24px;
        }

        p {
          margin: 0;
          color: var(--color-text-muted);
          font-size: 14px;
          font-weight: 400;
          line-height: 14px;
        }

        .login-error {
          margin: 0;
          color: #c62828;
          font-size: 14px;
          font-weight: 700;
          line-height: 14px;
        }

      }

      .card_notice {
        margin: 18px 0 0;
        color: var(--color-text-muted);
        font-size: 11px;
        font-weight: 400;
        line-height: 18px;
        text-align: center;
      }

      .card_body {
        display: grid;
        gap: 18px;

        .card_message {
          margin: 0;
          color: var(--color-text-muted);
          font-size: 14px;
          font-weight: 400;
          line-height: 14px;
        }

        .card_footer {
          margin: 6px 0 0;
          text-align: center;

          .form_link {
            color: var(--color-link);
            font-size: 12px;
            font-weight: 600;
            line-height: 12px;
            text-decoration: none;

            &:hover,
            &:focus-visible {
              color: var(--color-link-hover);
            }
          }
        }
      }

      &.consent-card {
        .card_header {
          margin-bottom: 26px;
        }

        .consent_app,
        .consent_scope {
          padding: 16px;
          border: 1px solid var(--slate-200);
          border-radius: 12px;
          background: rgba(255, 255, 255, 0.72);
        }

        .consent_app {
          display: flex;
          align-items: center;
          gap: 12px;

          .consent_app_icon {
            display: grid;
            width: 40px;
            height: 40px;
            place-items: center;
            border-radius: 10px;
            background: var(--gradient-brand-primary);
            color: var(--white);
            font-size: 18px;
            font-weight: 700;
          }
        }

        .consent_label,
        .consent_value {
          margin: 0;
        }

        .consent_label {
          color: var(--color-text-muted);
          font-size: 11px;
          line-height: 16px;
        }

        .consent_value {
          color: var(--color-text-heading);
          font-size: 14px;
          font-weight: 700;
          line-height: 20px;
        }

        .consent_scope_tag {
          display: inline-block;
          margin-top: 10px;
          padding: 4px 8px;
          border-radius: 6px;
          background: #e8f6fd;
          color: #0069a8;
          font-size: 11px;
          font-weight: 700;
        }

        .consent_form {
          display: grid;
          gap: 10px;
          margin-top: 2px;

          button {
            width: 100%;
            height: 46px;
            font-family: inherit;
            font-size: 14px;
          }

        }

        .consent_notice {
          margin: 0;
          color: var(--color-text-muted);
          font-size: 11px;
          line-height: 18px;
          text-align: center;
        }
      }

      .form {
        display: grid;
        gap: 12px;

        .login-credentials {
          display: grid;
          gap: 12px;
        }

        .form_item {
          .login-action-link {
            display: block;
            margin-top: 10px;
            padding: 0;
            border: 0;
            background: transparent;
            color: var(--color-link);
            font-family: inherit;
            font-size: 12px;
            font-weight: 600;
            text-align: left;

            &:hover,
            &:focus-visible {
              color: var(--color-link-hover);
            }
          }

          .password-policy-hint { display: block; margin-top: 6px; color: var(--slate-400); font-size: 12px; line-height: 17px; }

          label {
            display: inline-block;
            margin-bottom: 6px;
            color: var(--color-text-label);
            font-size: 12px;
            font-weight: 700;
            line-height: 12px;
          }

          input {
            width: 100%;
            height: 46px;
            padding: 0 16px;
            border: 1px solid var(--color-input-border);
            border-radius: 12px;
            outline: none;
            background: var(--white);
            box-shadow:
              0 1px 3px rgba(0, 0, 0, 0.1),
              0 1px 2px rgba(0, 0, 0, 0.1);
            color: #000;
            font-family: inherit;
            font-size: 13.4px;
            font-weight: 400;
            line-height: 12px;

            &:focus {
              border-color: var(--color-focus);
              box-shadow:
                0 1px 3px rgba(0, 0, 0, 0.1),
                0 1px 2px rgba(0, 0, 0, 0.1),
                0 0 0 2px var(--color-focus-ring);
            }
          }

          .form_label_row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 6px;

            label {
              margin-bottom: 0;
            }

            .form_link {
              color: var(--color-link);
              font-size: 12px;
              font-weight: 600;
              line-height: 12px;
              text-decoration: none;

              &:hover,
              &:focus-visible {
                color: var(--color-link-hover);
              }
            }
          }
        }

        .form_submit {
          width: 100%;
          height: 46px;
          margin-top: 6px;
          font-family: inherit;
          font-size: 14px;
          line-height: 14px;
        }

        .card_footer {
          margin: 6px 0 0;
          text-align: center;

          .form_link {
            color: var(--color-link);
            font-size: 12px;
            font-weight: 600;
            line-height: 12px;
            text-decoration: none;

            &:hover,
            &:focus-visible {
              color: var(--color-link-hover);
            }
          }
        }
      }
    }
  }
}

@media (max-width: 919px) {
  .login-page,
  .auth-page {
    grid-template-columns: 1fr;

    .inner {
      min-height: 18rem;
      padding: 24px 24px 16px;
    }

    .panel {
      min-height: auto;
      align-items: flex-start;
      padding: 24px 24px 40px;
    }
  }
}

@media (max-width: 429px) {
  .login-page,
  .auth-page {
    .brand {
      .text br {
        display: none;
      }
    }
  }
}
